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

React Navigation (Native) - Typescript Composite Screen Props - Navigation set to any

$
0
0

Goal: Trying to set types on navigation for a Tab screen navigating to a child Stack screen

Navigator Structure: TabNavigator parent that renders a StackNavigator

  const HomeStackScreen = () => (<HomeStack.Navigator><HomeStack.Screen name="Home" component={HomeScreen} /><HomeStack.Screen name="Person" component={PersonScreen} /></HomeStack.Navigator>  );  return (<Tab.Navigator><Tab.Screen name="HomeStack" component={HomeStackScreen} /><Tab.Screen name="AddPerson" component={AddPersonScreen} /></Tab.Navigator>  );

Problem: When using CompositeScreenProps, the route prop is typed but navigator prop isn't.

composite type helper

navigation has any type

Questions:

  1. Why is the route typed but navigation not?
  2. Is it ok to render a Tab as parent to Stack?
  3. How do I get the navigation to be typed?

Viewing all articles
Browse latest Browse all 6287

Trending Articles



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