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

Typescript migration throwing error on Stack.Screen options

$
0
0

I am converting an application from JS into TSX, but I encountered an error that I am not sure how to fix.

This is a function in my Screens.tsx file, and I have similar functions that are stacking other screens.

function ElementsStack(props: any) {  return (<Stack.Navigator mode="card" headerMode="screen"><Stack.Screen        name="Elements"        component={Elements}        options={{          header: ({ navigation, scene }) => (<Header title="Elements" navigation={navigation} scene={scene} />          ),          cardStyle: { backgroundColor: "#F8F9FE" },        }}      /></Stack.Navigator>  )}

The props that I am sending to the Header components (it's a .js file) are throwing me this error:

Type 'string' is not assignable to type 'never'.ts(2322)

Is there any way I can work around this error? Is that something that I can fix at the Header component level?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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