当我从一个页面转到另一个页面时,会弹出这个错误,虽然转换是成功的,但我想摆脱这个错误,这是我的代码示例,请告诉我如何修复这个错误?
function Root() { return ( <Drawer.Navigator initialRouteName="Home" //drawerContentOptions={{}} //drawerContent={<Text></Text>} screenOptions={{ drawerActiveTintColor: '#0069B3', itemStyle: { marginVertical: 5 }, }} drawerContent={(props) => <LeftMenu {...props} />}> <Drawer.Screen name="New" component={New} options={{ drawerLabel: '1',title: "1", headerStyle:{backgroundColor: '#0069B3', height: 75}, headerTintColor: '#fff', headerTitleStyle:{fontSize: 22, fontWeight: '600'}, headerTitleAlign: 'left'}}/> <Drawer.Screen name="Home" component={Main} options={{ drawerLabel: '2',title: "2", headerStyle:{backgroundColor: '#0069B3', height: 75}, headerTintColor: '#fff', headerTitleStyle:{fontSize: 22, fontWeight: '600'}, headerTitleAlign: 'left'}}/> </Drawer.Navigator> ); } export const Navigator =() =>{ const Stack = createStackNavigator(); return( <Stack.Navigator screenOptions={{}} initialRouteName="Authorization"> <Stack.Screen name="Root" component={Root}options={{ headerShown: false }}/> <Stack.Screen name="Root2" component={Root2}options={{ headerShown: false }}/> <Stack.Screen name="Authorization" component={Authorization} options={{ headerShown: false }}/> </Stack.Navigator> ) }
在我的页面上有一个navigation.setOptions参数,我把它放在useEffect中