我正在尝试构建像react-native-starter-app这样的应用。 我所做的只是安装文档中提到的包并仅修改index.ios.js,
错误讯息:
这是我的index.ios.js代码:
'use strict';
import React, {
AppRegistry,
StyleSheet,
NavigatorIOS,
Component,
Text,
View,
} from 'react-native';
var EventEmitter = require('EventEmitter');
var Subscribable = require('Subscribable');
// 3rd Party Components
var NavigationBar = require('react-native-navbar');
var SideMenu = require('react-native-side-menu');
// App Globals
var AppStyles = require('./ReactApp/styles.ios');
// Components
var Icons = require('./ReactApp/components/icons.ios');
var Menu = require('./ReactApp/components/menu.ios');
// Screens / Pages
var Index = require('./ReactApp/screens/tabbar.ios');
var NewsTable = require('./TFNewsTable');
var styles = StyleSheet.create({
container: {
flex: 1,
}
});
class MyRNApp extends Component {
render() {
const menu = <Menu navigator={navigator}/>;
return (
<SideMenu menu={menu}>
<NavigatorIOS
style={styles.container}
initialRoute={{
title: 'Title',
component: MyList,
leftButtonTitle: 'menu',
}}/>
</SideMenu>
);
}
}
AppRegistry.registerComponent('MyRNApp', () => MyRNApp);
当我第一次启动应用程序时,Subscribable.js文件位于node_modules文件夹中... 这是一个错误吗?
答案 0 :(得分:1)
尝试使用EventEmitter和Subscribable注释掉这两行。这些库应该用作mixin,因此ES6不支持它。