从'react'导入React,{组件};
从“ react-native”导入{StyleSheet,WebView,Platform,ActivityIndicator}; 从'react-native'导入{YellowBox}
YellowBox.ignoreWarnings(['WebView']) 导出默认类MainActivity扩展了组件{
ActivityIndicatorLoadingView(){
return (
<ActivityIndicator
color='#009688'
size='large'
style={styles.ActivityIndicatorStyle}
/>
);
}
render() {
return (
<WebView
style={styles.WebViewStyle}
source={{uri: 'https://google.com'}}
javaScriptEnabled={true}
domStorageEnabled={true}
renderLoading={this.ActivityIndicatorLoadingView}
startInLoadingState={true}
/>
);
}
}
常量样式= StyleSheet.create( {
WebViewStyle: { justifyContent:“中心”, alignItems:'中心', flex:1, 宽度:300
},
ActivityIndicatorStyle:{
left: 0,
right: 0,
top: 0,
bottom: 0,
alignItems: 'center',
justifyContent: 'center',
marginTop:300 } });