Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6208

getParam errors about Argument of type X is not assignable to parameter of type '"navigation" | "screenProps" | "navigationOptions"'

$
0
0

I've been trying to get react-navigation to play nice with typescript, but I'm having a hard time with all the warnings.

I tried looking into the types api but I can't really find what I'm supposed to do to make the warning go away.

const VenueDetails: NavigationScreenComponent<NavigationScreenProps> = ({
  navigation
}) => {
  const venueId: NavigationScreenProp<string> = navigation.getParam(
    'id',
    'NO-ID'
  )
return(...)
}

so getParam throws the following warning:

Argument of type '"id"' is not assignable to parameter of type '"navigation" | "screenProps" | "navigationOptions"'.ts(2345) And I have no idea what I'm doing wrong.


Viewing all articles
Browse latest Browse all 6208

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>