I'm using a bottomTabNavigator with lazy set to false. For the screen I render a react-native-webview. The render function is being called because I can see the console.log but the actual webview does not start loading till the tab becomes active. The tab I start on starts loading immediately.
Tab
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= />)
}
Navigator
const TabNavigator = createBottomTabNavigator(
{
TabOne: {
screen: Tab
},
TabTwo: {
screen: Tab
}
},
{
initialRouteName: 'TabOne',
lazy: false,
}
)
This happened after upgrading react-navigation from 1.x to 3.x and upgrading react-native and react-native-webview. I want the webview to start loading immediately, not just when visible.
from react-native-webview ONLY starts loading when on active tab in react-navigation tabNavigator
No comments:
Post a Comment