比如 scrollable-tab-view 里有三个 tab 每个的内容是 webview , 怎么才能让他们全都一起开始加载呢?? 现在是只有跳转到某个 tab, 它里面的 webview 才开始加载
代码
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
TouchableHighlight,
View,Navigator,TouchableOpacity,WebView
} from 'react-native';
import ScrollableTabView, {DefaultTabBar, } from 'react-native-scrollable-tab-view';
export class App extends Component {
constructor(props) {
super(props);
this.state = {
url: 'http://www.bing.com'
};
}
changeTab(tabName,el) {
}
renderContent(url) {
return (
<WebView
style={{ flex: 1 } }
ref = "AAA"
automaticallyAdjustContentInsets={ false }
source={ { uri: url } }
javaScriptEnabled={ true }
domStorageEnabled={ true }
scrollEnabled={ true }
decelerationRate="normal"
startInLoadingState={ true } />
);
}
render() {
return (
<ScrollableTabView
ref="tabView"
style={ { marginTop: 20 } }
onChangeTab={ this.changeTab }
renderTabBar={ () => <DefaultTabBar /> }
scrollWithoutAnimation={ true }>
<View
ref ="el1"
style={ styles.android }
tabLabel='page1'>
{ this.renderContent('http://v2ex.com') }
</View>
<View
ref ="el2"
style={ styles.android }
tabLabel='page2'>
{ this.renderContent('http://www.baidu.com') }
</View>
<View
style={ styles.android }
ref ="el3"
tabLabel='page3'>
{ this.renderContent('http://global.bing.com/?FORM=HPCNEN&setmkt=en-us&setlang=en-us') }
</View>
</ScrollableTabView>
);
}
componentDidMount(){
this.refs.tabView.goToPage(1);
this.refs.tabView.goToPage(2);
this.refs.tabView.goToPage(0);
// this.refs.tabView.goToPage(0);
console.log(this);
}
}
const styles = StyleSheet.create({
android: {
flex: 1
}
});
1
maomaomao001 OP @Kokororin 请帮帮我
|