React-native-track-player: usePlaybackState is not function

Created on 9 Jun 2019  路  7Comments  路  Source: react-native-kit/react-native-track-player

I have problem when get playbackState.
This is my code

`import TrackPlayer, { usePlaybackState } from 'react-native-track-player';

const playbackState = usePlaybackState();`

Invalid

Most helpful comment

100% guaranteed way to solve this issue is :
use like this "TrackPlayer.usePlaybackState() " instead of "import Trackplayer ,{usePlaybackState}"
it is all.

All 7 comments

usePlaybackState is a recent feature which has not been released yet. You'll not be able to use it just yet unless you're in the latest dev branch.

May I ask why you have it in the example/ in the master branch if it uses dev modules and functions? @Guichaguri

This issue is quite old, and it has been released in 1.1.6 and newer.

@Guichaguri I'm using 1.1.8 and I'm still getting this error, can you explain? Thank you.

@jandog8990 +1

@jandog8990 +1

It's listed in the example folder and running a fresh project off the example crashes. This issue should be re-opened and resolved. I see it in the react-native-track-player/lib/hooks but still can't reference or load it.

Even updating to dev branch npm install --save react-native-kit/react-native-track-player#dev the same problem persists running the demo code.

100% guaranteed way to solve this issue is :
use like this "TrackPlayer.usePlaybackState() " instead of "import Trackplayer ,{usePlaybackState}"
it is all.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moduval picture moduval  路  3Comments

KalebPortillo picture KalebPortillo  路  4Comments

toooldmohammad picture toooldmohammad  路  3Comments

tarahiw picture tarahiw  路  3Comments

ManrickCapotolan picture ManrickCapotolan  路  4Comments