How to use index.js instead of (index.ios.js, index.android.js) in React Native for cross-platform app?

后端 未结 3 1886
情书的邮戳
情书的邮戳 2020-12-30 03:48

Thanks for the answers from now,

I am a newbie in React Native, I want to make a cross-platform app so I created index.js:

import Re         


        
3条回答
  •  情歌与酒
    2020-12-30 04:12

    After React v0.49, you don't need index.ios.js and index.android.js. You only need the index.js:

    import {AppRegistry} from 'react-native';
    import App from './app/App';
    
    AppRegistry.registerComponent('appMobile', () => App);
    

    (replace appMobile with the name of your app)

    Source: (https://github.com/facebook/react-native/releases/tag/v0.49.0)

    New projects have a single entry-point (index.js) from now on

提交回复
热议问题