美文网首页
RN学习5.31 -- 合并ios.index.js 和 and

RN学习5.31 -- 合并ios.index.js 和 and

作者: watts_log | 来源:发表于2017-05-31 16:23 被阅读202次

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.运行

运行结果iOS.png

Ps:如有错误,欢迎指出。

相关文章

网友评论

      本文标题:RN学习5.31 -- 合并ios.index.js 和 and

      本文链接:https://www.haomeiwen.com/subject/apljfxtx.html