进度栏加载但无法打开uri

时间:2019-06-21 12:50:26

标签: react-native

从'react'导入React,{组件};

从“ react-native”导入{StyleSheet,WebView,Platform,ActivityIndi​​cator}; 从'react-native'导入{YellowBox}

YellowBox.ignoreWarnings(['WebView']) 导出默认类MainActivity扩展了组件{

ActivityIndi​​catorLoadingView(){

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

},

ActivityIndi​​catorStyle:{

left: 0,
right: 0,
top: 0,
bottom: 0,
alignItems: 'center',
justifyContent: 'center',

marginTop:300 } });

0 个答案:

没有答案