小编Yvo*_*lon的帖子

防止卸载 react-navigation stacknavigator 屏幕

我有屏幕 A(仪表板)和屏幕 B(详细信息)。

当您单击仪表板中的按钮时,您将导航到详细信息。这是通过 react-navigation (v1.5) stackrouter 完成的。当您导航回来时,详细信息屏幕将被卸载,您将返回仪表板。

当您返回时,是否可以保持详细信息屏幕处于安装状态?

react-native react-navigation

5
推荐指数
1
解决办法
1411
查看次数

当在react-navigation选项卡中的active选项卡上时,react-native-webview仅开始加载

我使用的是bottomTabNavigatorlazy设置为false。对于屏幕,我渲染了react-native-webview。之所以调用render函数,是因为我可以看到console.log,但是直到选项卡被激活,实际的Webview才开始加载。我开始的选项卡立即开始加载。

标签

const Tab = () => { 
    console.log('render') // this is being called right away

    return (<WebView 
             onLoadStart={() => console.log('on load start') // this is being called only when tab becomes active (clicking on it) }
             source={{uri:'linkgoes.here'}} />) 
}
Run Code Online (Sandbox Code Playgroud)

航海家

  const TabNavigator = createBottomTabNavigator(
  {
    TabOne: {
      screen: Tab
    },
    TabTwo: {
      screen: Tab
    }
  },
  {
    initialRouteName: 'TabOne',
    lazy: false,
  }
)
Run Code Online (Sandbox Code Playgroud)

react-navigation从1.x 升级到3.x并升级react-nativereact-native-webview。我希望webview立即开始加载,而不只是在可见时开始加载。

javascript react-native react-navigation react-native-webview

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