react-native-youtube icon indicating copy to clipboard operation
react-native-youtube copied to clipboard

typescript type signature error

Open idhowardgj94 opened this issue 4 years ago • 3 comments

  • 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

idhowardgj94 avatar Aug 12 '20 04:08 idhowardgj94

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

this-username-is-taken avatar Sep 23 '20 00:09 this-username-is-taken

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 :)

luizppa avatar Feb 11 '21 15:02 luizppa

I've found time sooner than expected. Pull request #505.

luizppa avatar Feb 11 '21 23:02 luizppa