標題重寫為:無法在渲染`Main2`元件時更新`DrawerNavigator`元件
P粉131455722
P粉131455722 2023-09-12 23:32:39
0
1
404

當我從一個頁面轉到另一個頁面時,會彈出這個錯誤,雖然轉換是成功的,但我想擺脫這個錯誤,這是我的程式碼範例,請告訴我如何修復這個錯誤?

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粉131455722
P粉131455722

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!