1.新建APP/app.js
2.ios.index.js 和 android.index.js 粘贴如下代码
ios:
import React, {
Component,
} from 'react';
import {
AppRegistry,
} from 'react-native';
import App from './App/app'
AppRegistry.registerComponent('AwesomeProject_Watts', () => App);
android:
import React, {
Component
} from 'react';
import {
AppRegistry,
} from 'react-native';
import App from './App/app'
AppRegistry.registerComponent('AwesomeProject_Watts', () => App);
import App from './App/app'
从APP/app.js文件中导入 App 模块
3.app.js:
import React, {
Component,
} from 'react';
import {
TabBarIOS,
NavigatorIOS,
View,
Image,
} from 'react-native';
class App extends Component {
render() {
return (
<View>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'skyblue'}} />
<View style={{width: 150, height: 150, backgroundColor: 'steelblue'}} />
</View>
);
}
}
export default App;
export default App;
导出 APP 模块
4.运行
Ps:如有错误,欢迎指出。