且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在React Native中使用index.js代替(index.ios.js,index.android.js)进行跨平台应用?

更新时间:2022-12-29 16:29:51

React v0之后.49,你不需要 index.ios.js index.android.js 。您只需要 index.js

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);

(用你的名字替换 appMobile app)

(replace appMobile with the name of your app)

资料来源:( https://github.com/facebook/react-native/releases/tag/v0.49.0


从现在开始,新项目只有一个入口点(index.js)

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