我是在反应原生文档中的例子,不知道为什么我的web视图不会加载网站。反应原生WebView没有加载源码
这里是我的代码:
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
Image,
TextInput,
Button,
TouchableHighlight,
TouchableOpacity,
StatusBarIOS,
WebView
} from 'react-native';
StatusBarIOS.setStyle(1);
import Dimensions from 'Dimensions';
var width = Dimensions.get('window').width;
var height = Dimensions.get('window').height;
var CStyles = require('./CStyle');
class TestComp extends Component {
constructor(){
super();
this.state = {
url: 'https://www.google.at/'
}
}
render() {
return (
<View style={{flex: 1}}>
<WebView
ref="webview"
style={{width: width}}
automaticallyAdjustContentInsets={false}
source={{uri: this.state.url}}
javaScriptEnabled={true}
domStorageEnabled={true}
decelerationRate="normal"
startInLoadingState={true}
/>
</View>
);
}
}
module.exports = TestComp;
现在我得到视觉上是一个微调,表示有些事情是加载。但没有任何变化。
我在做一些根本性的错误吗?
根据评论者,这似乎是一个根本的问题,我已经开了GH问题是,随意贡献https://github.com/facebook/react-native/issues/5974
不,我试着用一个普通的html代码,它也说加载。我想在RN中有一个错误,尝试在github上打开一个问题。 –
我这样做,并粘贴链接在这里 –
@ noa-dev我试图重现此问题。 CStyle的内容是什么? 'var CStyles = require('./ CStyle');'这个例子来自哪里? – zipzit