【发布时间】:2016-06-27 21:09:56
【问题描述】:
我正在尝试共享相同的代码库,因此我将代码写入了 index.js 文件中,并将相同的代码放入了 index.ios.js 和 index.android.js 文件中。
这是index.ios.js中的代码:
'use strict';
import React, { AppRegistry } from 'react-native';
import MYCLASS from './index';
AppRegistry.registerComponent('MYCLASS', () => MYCLASS);
这是index.js中的部分代码:
export default class MYCLASS extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>
my text
</Text>
</View>
);
}
}
【问题讨论】:
标签: javascript android react-native ecmascript-6