【发布时间】:2016-01-20 12:42:32
【问题描述】:
我刚刚加了
var React = require('react-native');
到我的 index.ios.js 文件,但是当我重新加载我的 React Native 应用程序时,这 出现:
所以我尝试通过这样做来更改 react-native 模块的权限
sudo chmod -R 777 ExampleProject
sudo chmod -R 777 ExampleProject/node_modules/react-native
但它仍然不起作用。我做错了什么?
这是我的 index.ios.js 文件的完整源代码:
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View
} from 'react-native';
class Logbook extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('Logbook', () => Logbook);
【问题讨论】:
-
你能把你的
index.ios.js文件的所有代码都包含进去吗?
标签: javascript reactjs react-native