I'm creating a Expo managed React Native app with TypeScript and having some problems with React Navigation and TypeScript.
I want to specify the icon for the Bottom Tab Navigator on the Tab.Screen component.
This code works but complains because route.params could be undefined (line 10).
Property 'icon' does not exist on type 'object'
Can I make the icon prop required on initialParams?
I have looked in the documentation without any luck.
const App: React.FC<{}> = () => { return (<SafeAreaView style={styles.container}><NavigationContainer><Tab.Navigator screenOptions={({ route }) => ({ tabBarIcon: ({ size, color }) => (<MaterialIcons size={size}/* ===> */ name={route.params.icon} color={color} /> ), })}><Tab.Screen name="EventListView" initialParams={{ icon: 'view-agenda' }} component={EventListScreen} /><Tab.Screen name="CreateEvent" initialParams={{ icon: 'public' }} component={SettingsScreen} /></Tab.Navigator></NavigationContainer></SafeAreaView> )}