React-native-track-player: typescript: usePlaybackState has not exported

Created on 12 Sep 2020  路  6Comments  路  Source: react-native-kit/react-native-track-player

Describe the bug
I am getting waring (Module '"../../../../node_modules/react-native-track-player"' has no exported member 'useTrackPlayerProgress'.) when I am importing hook like usePlaybackState, useTrackPlayerProgress and useTrackPlayerEvents.
would you help me how i could fix this problem?

Code
`import TrackPlayer, {
usePlaybackState,
useTrackPlayerProgress,
useTrackPlayerEvents,

} from 'react-native-track-player';`

Bug Needs Confirmation

Most helpful comment

I'm able to import them by reaching directly into the package's hooks directory:

import {
  useTrackPlayerProgress,
  useTrackPlayerEvents,
} from "react-native-track-player/lib/hooks"

I know the issue is closed, but maybe that will help anyone else who winds up reading this issue.

All 6 comments

@itsgracian hey did you find a solution to this? I'm getting it also..

Hello, @TowhidKashem yes. uninstall react-native-track-player and install yarn add react-native-track-player@next

@TowhidKashem this hooks useTrackPlayerProgress was changed to useProgress

That will install v2 of the library though and I'm not 100% sure but I think that's still in beta (or at least it doesn't seem to me very stable from some comments). I think I'll just deal with the TS error with a ts-ignore ignore comment for now, although it doesn't make sense how it's even working with the renaming but it is.

I'm able to import them by reaching directly into the package's hooks directory:

import {
  useTrackPlayerProgress,
  useTrackPlayerEvents,
} from "react-native-track-player/lib/hooks"

I know the issue is closed, but maybe that will help anyone else who winds up reading this issue.

Hi, would you please release a new version with the fix?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sagargheewala picture sagargheewala  路  3Comments

moduval picture moduval  路  4Comments

tarahiw picture tarahiw  路  3Comments

krunalbad picture krunalbad  路  3Comments

Sathyanarayan09 picture Sathyanarayan09  路  3Comments