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

react navigation: how to pass redux props with NavigationStackScreenComponent type in typescript

$
0
0

I started using typescript in my react native project (typescript newbie) and hit a problem with navigationOptions in functional component with typescript, i solved it thanks to this post here however when i try to pass redux props its telling me

Property 'authType' does not exist on type 'PropsWithChildren<NavigationStackScreenProps<Params, Props>>

this is my code

interface Props {
 authType: string;
}

interface Params {
 routeName: string;
}

const Customer: NavigationStackScreenComponent<Params, Props> = ({
 navigation,
 authType,
 }) => {
 .... Component
 }

 Customer.navigationOptions = ({ navigation }) => ({
   title: navigation.getParam('routeName'),
 });

I think this means that the prop i am passing is not being read although i am passing it.

I used NavigationStackScreenComponent in order to be able to use

Customer.navigationOptions etc

otherwise its gonna tell me

ts] Property 'navigationOptions' does not exist

I am really beggining to love typescript , Any idea how to use authType Props without it screaming at me ?


Viewing all articles
Browse latest Browse all 6208

Trending Articles



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