I have a react native
app with navigation
stack defined:
<Stack.Navigator initialRouteName={NavigationLocations.SIGNUP} ... }}> ...<Stack.Screen name={NavigationLocations.SHEET} component={Sheet} options={ { title: "Character sheet", headerLeft: null }} /></Stack.Navigator>
This is my navigation props
definition:
export type RootStackParamList = { Signup: undefined, Login: undefined, Dashboard: undefined, SheetView: {sheet: ISheet}};
How should I define the sheet props in the component that is receiving the sheet
object passed by the navigation?
type Props = StackScreenProps<RootStackParamList, NavigationLocations.SHEET>export default function Sheet({sheet}: Props) { const sheet = props.route.params.sheet;
Currently I am getting this error: Error:(11, 32) TS2339: Property 'sheet' does not exist on type 'StackScreenProps<RootStackParamList, NavigationLocations.SHEET>'.
I am using the NavigationLocations
enum because I generally dislike using strings as identifiers, but I think that my implementation has introduced an error here. What am I doing wrong?