React Native Webview 未加载任何 url(React Native Web 视图不起作用) [英] React Native Webview not loading any url (React native web view not working)

查看:47
本文介绍了React Native Webview 未加载任何 url(React Native Web 视图不起作用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用程序中实现 react native webview 组件,但是 web 视图没有加载任何 url,它只是显示了白页.

I am trying to implement react native webview component in my application, but the web view is not loading any url its just showing the white page.

var React = require('react-native');
var{
 View,
 Text,
 StyleSheet,
 WebView
} = React;


module.exports = React.createClass({
 render: function(){
   return(
     <View style={styles.container}>
      <WebView source={{uri: 'https://m.facebook.com'}} style= {styles.webView}/>
     </View>
   );
 }
});

var styles = StyleSheet.create({
   container: {
     flex:1,
     backgroundColor:  '#ff00ff'
   },webView :{
     height: 320,
     width : 200
   }
});

下面是输出的截图.

推荐答案

以下是对我有用的代码片段.

Below is piece of the code which worked for me.

render: function(){
   return(
     <View style={styles.container}>
      <WebView url={'https://m.facebook.com'} style= {styles.webView}/>
     </View>
   );
 }

这篇关于React Native Webview 未加载任何 url(React Native Web 视图不起作用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆