我正在使用设置为的bottomTabNavigator。对于屏幕,我呈现react-native-webview。正在调用渲染函数,因为我可以看到 console.log 但实际的 webview 直到选项卡变为活动状态才开始加载。我开始的选项卡立即开始加载。lazy
false
标签
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'}} />)
}
航海家
const TabNavigator = createBottomTabNavigator(
{
TabOne: {
screen: Tab
},
TabTwo: {
screen: Tab
}
},
{
initialRouteName: 'TabOne',
lazy: false,
}
)
这发生在react-navigation
从 1.x 升级到 3.x 并升级react-native
和react-native-webview
. 我希望 webview 立即开始加载,而不仅仅是在可见时。