React native 道具组件未安装';不能在react native for android中工作
这是我的代码:React native 道具组件未安装';不能在react native for android中工作,react-native,React Native,这是我的代码: <NavigationContainer> <MyDrawer.Navigator initialRouteName="Main" drawerContentOptions={{ activeTintColor: '#FFF', itemStyle: { marginVertical: 5 }, }}
<NavigationContainer>
<MyDrawer.Navigator
initialRouteName="Main"
drawerContentOptions={{
activeTintColor: '#FFF',
itemStyle: { marginVertical: 5 },
}}
drawerStyle={{
backgroundColor: '#ea2d49',
width: 240,
marginTop:'23%',
color: '#fff'
}} >
<MyDrawer.Screen name="Home" component={StackScreen}/>
</MyDrawer.Navigator>
</NavigationContainer>
现在的问题是组件中的StackScreen功能不起作用
这是我的StackScreen功能:
function StackScreen({ navigation }) {
return (
<Stack.Navigator>
<Stack.Screen
name="Home2"
component={FeedTab}
options={{ title: 'Home',headerTintColor: '#fff',headerStyle: {
backgroundColor: '#ea2d49'
},headerLeft: () => (
<TouchableOpacity style={{ marginLeft : 10}} onPress={() => navigation.toggleDrawer()}><MaterialCommunityIcons name="apps" size={30} color={'#FFF'}/></TouchableOpacity>
), }}
/>
</Stack.Navigator>
);
}
function FeedTab() {
return(
<Tab.Navigator
initialRouteName="DapAn"
tabBarOptions={{
activeTintColor: '#FFFFFF',
activeBackgroundColor : '#ea2d49',
}}>
<Tab.Screen
name="DapAn"
component={DapAnScreen}
options={{
title : 'Something',
tabBarLabel :'Something',
tabBarIcon: ({ color, size }) => (
<AntDesign name="info" color={color} size={size} />
),
}} />
<Tab.Screen
name="ChamBai"
component={ChamBaiScreen}
options={{
title: 'Something',
tabBarLabel: 'Somethingi',
tabBarIcon: ({ color, size }) => (
<AntDesign name="check" color={color} size={size} />
),
}} />
</Tab.Navigator>
)
}
函数堆栈屏幕({navigation}){
返回(
(
navigation.toggleDrawer()}>
), }}
/>
);
}
这是我的FeedTab函数:
function StackScreen({ navigation }) {
return (
<Stack.Navigator>
<Stack.Screen
name="Home2"
component={FeedTab}
options={{ title: 'Home',headerTintColor: '#fff',headerStyle: {
backgroundColor: '#ea2d49'
},headerLeft: () => (
<TouchableOpacity style={{ marginLeft : 10}} onPress={() => navigation.toggleDrawer()}><MaterialCommunityIcons name="apps" size={30} color={'#FFF'}/></TouchableOpacity>
), }}
/>
</Stack.Navigator>
);
}
function FeedTab() {
return(
<Tab.Navigator
initialRouteName="DapAn"
tabBarOptions={{
activeTintColor: '#FFFFFF',
activeBackgroundColor : '#ea2d49',
}}>
<Tab.Screen
name="DapAn"
component={DapAnScreen}
options={{
title : 'Something',
tabBarLabel :'Something',
tabBarIcon: ({ color, size }) => (
<AntDesign name="info" color={color} size={size} />
),
}} />
<Tab.Screen
name="ChamBai"
component={ChamBaiScreen}
options={{
title: 'Something',
tabBarLabel: 'Somethingi',
tabBarIcon: ({ color, size }) => (
<AntDesign name="check" color={color} size={size} />
),
}} />
</Tab.Navigator>
)
}
函数FeedTab(){
返回(
(
),
}} />
(
),
}} />
)
}
它似乎不工作时,通过道具的屏幕,我错了吗?我怎样才能解决这个问题?
我的依赖项:
@反应导航/底部选项卡“^5.11.8”,
“@react导航/抽屉”:“^5.12.4”,
“@react导航/native”:“^5.9.3”,
“@react导航/堆栈”:“^5.14.3”,
“反应”:“16.13.1”,
“react dom”:“^16.13.1”,
“反应本机”:“0.63.4”,
“react本机文档选择器”:“^5.0.3”,
“反应本机fs”:“^2.17.0”,
“反应本机手势处理程序”:“^1.9.0”,
“反应本地复活”:“^1.13.2”,
“反应本机呈现html”:“^5.1.0”,
“反应本机安全区域上下文”:“^3.2.0”,
“反应本机屏幕”:“^2.18.1”,
“反应本机矢量图标”:“^8.1.0”,
“反应本机web”:“^0.14.7”
非常感谢!我发现一个解决方案是在NavigationContainer标记之前删除任何标记