反应本机:底部标签不起作用
在我的React-native应用程序中,我有一个底部标签导航,我在其中一个屏幕上添加了一个TabPress侦听器,但是由于某些原因,现在所有屏幕都不起作用,当我点击图标时,我无法导航到其他屏幕。 ..
目的是根据一天的屏幕锁定屏幕,但是现在由于某种原因,所有屏幕都锁定了,我无法导航到任何屏幕!
<Tab.Navigator /* options here... */>
<Tab.Screen name="Descubre" component={STACK1} />
<Tab.Screen name="Favoritos" component={STACK2}
listeners={{
tabPress: (e) => {
if(root.mapStore.isoWeekDay == 6)
{
e.preventDefault();
}
},
}}
/>
<Tab.Screen name="Pedidos" component={STACK3} />
<Tab.Screen name="Más" component={STACK4}/>
</Tab.Navigator>
in my react-native app I have a bottom tabs navigation, I added a tabPress listener to one of the screens but for some reason now all screens don't work, I can't navigate to a different screen when I tap the icons...
The objective was to lock a screen depending of the day but now ALL screens are locked for some reason and I can't navigate to ANY screen!
<Tab.Navigator /* options here... */>
<Tab.Screen name="Descubre" component={STACK1} />
<Tab.Screen name="Favoritos" component={STACK2}
listeners={{
tabPress: (e) => {
if(root.mapStore.isoWeekDay == 6)
{
e.preventDefault();
}
},
}}
/>
<Tab.Screen name="Pedidos" component={STACK3} />
<Tab.Screen name="Más" component={STACK4}/>
</Tab.Navigator>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜这是此事件中的React本机构成的默认行为,请检查 fivest fivest < /a>
如果您只想阻止其中一个屏幕,则可以执行以下操作:
在哪里disabledtabbarbutton是:
并启用了一个:
另外,您在创建标签导航器时可以执行以下操作:
I'm guessing this is the default behaviour stablished by React Native for this event, check section Listening to events
If you want only to block one of the screens in this point, you could do the following:
Where DisabledTabBarButton is:
And enabled one:
Also, you could do the following while creating your tab navigator: