如何防止重新加载WebView页面[Android React Native]
问题描述:
我已经创建了应用程序,其中我有3个选项卡以使用React Native显示网页。每当我切换到标签2从标签1,然后回到标签1,webview它仍然工作,而不是重新加载,但是当我切换到标签3时,标签1和2重新加载时,当我回到标签1或标签2从标签3中。所以,我认为它不适用于WebView的3个标签?如何防止重新加载WebView页面[Android React Native]
我使用react-native-router-flux来创建一个tabbar。
<Scene key="root" tabs={true}>
<Scene key="menus">
<Scene key="tabbar" tabs={true} tabBarStyle={{backgroundColor:'#f7f7f7'}}>
<Scene key="Schedule" component={Schedule} title="Schedule" icon={TabIcon} hideNavBar={true}/>
<Scene key="Chatbox" component={Chatbox} title="Chatbox" icon={TabIcon} hideNavBar={true}/>
<Scene key="Home" component={Home} title="Home" icon={TabIcon} hideNavBar={true}/>
<Scene key="Podcast" component={Podcast} title="Podcast" icon={TabIcon} hideNavBar={true}/>
<Scene key="About" component={About} title="About" icon={TabIcon} hideNavBar={true}/>
</Scene>
</Scene>
</Scene>
这是从1 3页的WebView代码:
var sourceChatbox = {uri: 'URL_HERE'};
return(
<Container>
{this.renderHeader()}
<Content contentContainerStyle={{flex: 1, margin: 10, marginBottom: 60}}>
<WebView source={sourceChatbox}/>
</Content>
</Container>
);
感谢您的帮助。我从来没有使用
答
反应本地路由器通量之前,目前越来越多的人正在使用的反应导航更多,也许你应该检查出
尼斯,它与反应的导航工作。但我不知道为什么它总是重新加载RN路由器通量,也许有些人知道如何解决。以前感谢。 – ASHafizullah