感谢您从现在开始的回答,
我是React Native的新手,我想做一个跨平台的应用所以我创建了index.js:
import React từ 'react';
nhập khẩu {
Component,
View,
Text,
} from 'react-native';
class ReactApp extends Component {
render() {
trở lại (
Hello world
);
}
}
module.exports = ReactApp;
然后我像这样从 index.ios.js 和 index.android.js 导入 index.js:
import { AppRegistry } from 'react-native';
import ReactApp from './index';
AppRegistry.registerComponent('ReactApp', () => ReactApp);
我认为在此之后它应该可以工作,但我明白了错误:
在 React v0.49 之后,您不再需要 index.ios.js
Và index.android.js
。你只需要 index.js
:
import {AppRegistry} from 'react-native';
import App from './app/App';
AppRegistry.registerComponent('appMobile', () => App);
(将 appMobile
替换为您的应用名称)
来源:(https://github.com/facebook/react-native/releases/tag/v0.49.0)
New projects have a single entry-point (index.js) from now on
Tôi là một lập trình viên xuất sắc, rất giỏi!