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

Defining route types in React Native in stack navigator

$
0
0

the code below shows one of my screens and I need to get the title from params. But Eslint and typescript complains.

<Stack.Screen    name="MarketAssetDetailsPage"    options={({ route }) => ({      title: `${route.params?.routeName} Market Details`,      headerStyle: {        backgroundColor: route.params?.data.assetColor,      },      headerBackTitleVisible: false,    })}    component={MarketAssetDetailsPage}  />

I know we can use RouteProp in components but it doesn't work here. How do I define the types of route (which destructred from options) so it doesn't complain?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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