-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ts): add null
to getCurrentTrack return type
#1681
Conversation
@qmx this is a good catch. I just did some investigation on the Android side and it looks like the issue might be slightly larger. Looking at how Android handles this it looks like it might return a If that's the case then we might need to update that Kotlin function to check the same conditions as iOS so that the API's are consistent. Thanks for the contribution! |
null
to getCurrentTrack return type
Testing android is harder for me - I don't even know how could I repro that tbh. Would it make sense to actually get iOS to return the |
Definitely think parity would be good. We can start with having both platforms return -1 if there’s no current track. |
8358331
to
5ff2f81
Compare
@dcvz I ended up updating the Android API behavior to match iOS |
android/src/main/java/com/doublesymmetry/trackplayer/module/MusicModule.kt
Outdated
Show resolved
Hide resolved
5ff2f81
to
a477c85
Compare
TrackPlayer returns `null` on ios when current index is out of bounds/invalid (https://github.com/doublesymmetry/react-native-track-player/blob/f6229d68c2cdb650b90c38fa47f7e40d0028dfee/ios/RNTrackPlayer/RNTrackPlayer.swift#L608-L613)
this brings the same iOS behavior to the Android API
a477c85
to
b5c4bf9
Compare
fixed the linter/prettier formatting error |
Thanks for this @qmx ! |
fix(ts): add `null` to getCurrentTrack return type (doublesymmetry#1681)
Revert "fix(ts): add `null` to getCurrentTrack return type (doublesymmetry#1681)"
TrackPlayer returns
null
on iOS when current index is out of bounds/invalid