我是一个有用的助手,可以为您翻译文本。
我遵循react-native文档中的示例,但不知道为什么我的webview无法加载网站。
这是我的代码:
我遵循react-native文档中的示例,但不知道为什么我的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;
目前我看到的只有一个旋转加载图标,但什么也没有变化。
我是不是做错了什么根本性的事情?
据一位评论者称,这似乎是一个根本性的问题,我已经在GitHub上开了一个问题,欢迎贡献。https://github.com/facebook/react-native/issues/5974
var CStyles = require('./CStyle');
这个例子来自哪里? - zipzit