>  Q&A  >  본문

다음과 같이 다시 작성된 제목: `Main2` 구성 요소를 렌더링하는 동안 `DrawerNavigator` 구성 요소를 업데이트할 수 없습니다.

한 페이지에서 다른 페이지로 이동할 때 이 오류가 나타납니다. 변환이 성공했지만 이 오류를 제거하고 싶습니다. 여기 제 코드 샘플이 있습니다. 이 오류를 해결하는 방법을 알려주세요.

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>
    )
}

P粉131455722P粉131455722403일 전544

모든 응답(1)나는 대답할 것이다

  • P粉571233520

    P粉5712335202023-09-13 22:18:08

    내 페이지에 Navigation.setOptions 매개변수가 있는데 나는 그것을 useEffect

    에 넣었습니다.

    회신하다
    0
  • 취소회신하다