gpt4 book ai didi

ios - React Native - 无法读取未定义的属性 'addListener'

转载 作者:行者123 更新时间:2023-11-29 01:12:42 25 4
gpt4 key购买 nike

我正在尝试构建类似 react-native-starter-app 的应用程序.我所做的只是安装文档中提到的包并仅修改 index.ios.js,

错误信息:

enter image description here

这是我的 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 文件夹中......这是不是错误?

最佳答案

尝试用 EventEmitter 和 Subscribable 注释掉这两行。这些库应该用作 mixins,因此 ES6 不支持它。

关于ios - React Native - 无法读取未定义的属性 'addListener',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35568272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com