react-native-youtube
react-native-youtube copied to clipboard
typescript type signature error
- package version: 2.0.1
- react-native version: 0.63.2
- typescript version: 3.8.2
issue:
just try example from readme.md,
and got type error:
// ....
<View>
<YouTube
videoId="KVZ-P-ZI6W4" // The YouTube video ID
play // control playback of video with true/false
fullscreen // control whether the video should play in fullscreen or inline
loop // control whether the video should loop when ended
onReady={(e) => this.setState({ isReady: true })}
onChangeState={(e)=> this.setState({ status: e.state })}
onChangeQuality={(e) => this.setState({ quality: e.quality })}
onError={e => this.setState({ error: e.error })}
style={{ alignSelf: 'stretch', height: 300 }}
/>
</View>
error is on onChangeState and onChangeQuality Callback function signature, remove all "e" params will remove the error.
onChangeState?: (() => void) | undefined
onChangeQuality?: (() => void) | undefined
I think the typescript signature is either incorrect or out of date.
Changing onChangeState?: () => void)
to onChangeState?: (event: any) => void;
in main.d.ts
will solve this problem
I'm gonna try to open a pull request next week if I find some time. Would be nice to have a more definitive solution for that matter :)
I've found time sooner than expected. Pull request #505.