小编Smi*_*mit的帖子

在TabNavigator中阻止/禁用选项卡 - react-navigation

我有一个TabNavigator,如图所示. 标题图片

我正在使用TabNavigator创建这些选项卡,如下所示.

const Tab_Navigator = TabNavigator({
    First:{
        screen: First,
    },
    Second:{
        screen: Second,
    },
    Third:{
        screen: Third,
    },
Run Code Online (Sandbox Code Playgroud)

现在我想阻止/禁用"第二"和"第三"选项卡.它应该是可见的,但是人们不应该导航到它们.

我尝试阻止这些显示,如我所示,但我想我错过了一些东西.我的尝试:

Tab_Navigator.router.getStateForAction = (action, state) => {
if( action.type === NavigationActions.navigate({ routeName: "Second"}) ||
    action.type === NavigationActions.navigate({ routeName: "Third"}))
{
    return null;
}

return Byte.router.getStateForAction(action, state);
Run Code Online (Sandbox Code Playgroud)

};

tabnavigator react-native react-native-android react-native-ios react-navigation

4
推荐指数
2
解决办法
4126
查看次数

如何在反应原生中缩小WebView?

我在react-native中使用"WebView"来呈现网页.该网页没有适合移动设备的用户界面.

当我在Chrome浏览器中打开它时,它看起来如下所示.而且我想要下面这样

在此输入图像描述

但是当我在代码下面渲染时,它看起来像下面显示的图像.请参阅我已经尝试了不同的道具automaticallyAdjustContentInsets = {false},scalesPageToFit={false}.但它没有给我欲望输出.

render(){
    const URL  = "https://stellarterm.com";
    return(
          <WebView 
             source={{URL}}
          />
Run Code Online (Sandbox Code Playgroud)

结果

在此输入图像描述

如果有,请随时提出任何解决方案.任何第三方图书馆也都可以.

android webview reactjs react-native react-native-android

2
推荐指数
1
解决办法
2203
查看次数