webview跳转页面抛错:encountered an error loading page



  • 详细错误信息:
    Encountered an error loading page:{canGoForward:false,code:-2,net:err_name_not_resolved,loading:false,url:https://www.baidu.com}
    代码:
    import React,{Component} from 'react';
    import{
    AppRegistry,
    StyleSheet,
    Dimensions,
    Text,
    View,
    WebView
    } from 'react-native';

    var {
    height:deviceHeight,
    width:deviceWidth
    }=Dimensions.get('window');

    export default class App extends Component{
    render(){
    return(
    <View style={styles.container}>
    <WebView bounces={false}
    scalesPageToFit={true}
    javaScriptEnabled={true}
    source={{uri:"https://www.baidu.com/"}}
    style={{height:deviceHeight,width:deviceWidth}}>

        </WebView>
      </View>
    );
    

    }
    }

    const styles=StyleSheet.create({
    container:{
    flex:1,
    paddingTop:20
    }
    });


Log in to reply