diff --git a/example/src/components/ReactNavigationDetailScreen.tsx b/example/src/components/ReactNavigationDetailScreen.tsx index d77936d7..dcfcea37 100644 --- a/example/src/components/ReactNavigationDetailScreen.tsx +++ b/example/src/components/ReactNavigationDetailScreen.tsx @@ -1,29 +1,29 @@ import * as React from 'react'; import { Button, Text } from 'react-native'; -import type { ScreenProps } from '../types/Navigation'; +import type { Routes } from '../types/Navigation'; import { SafeAreaViewVisualizer } from './SafeAreaViewVisualizer'; +import { useNavigation } from '@react-navigation/native'; +import { NativeStackNavigationProp } from '@react-navigation/native-stack'; -export default function ReactNavigationDetailScreen({ - navigation, -}: ScreenProps<'Details'>) { - const isV5 = typeof navigation.setOptions === 'function'; +export default function ReactNavigationDetailScreen() { const [headerShown, setHeaderShown] = React.useState(true); + const { navigate, goBack, setOptions, push } = + useNavigation>(); + + const isV5 = typeof setOptions === 'function'; React.useLayoutEffect(() => { if (isV5) { - navigation.setOptions({ headerShown }); + setOptions({ headerShown }); } - }, [navigation, isV5, headerShown]); + }, [setOptions, isV5, headerShown]); return ( Details Screen -