简体   繁体   English

无法解析模块ReactNativeEventEmitter

[英]Unable to resolve module ReactNativeEventEmitter

After upgrading React Native from 0.29 to 0.30, I get this error message. 将React Native从0.29升级到0.30后,我收到此错误消息。 I multiple times deleted node_modules, installed them back again, cleared watchman cache and npm start --reset-cache. 我多次删除了node_modules,再次安装它们,清除了watchman缓存和npm start --reset-cache。

I tried it also on new project with react-native init someProject. 我也尝试了使用react-native init someProject的新项目。 The same error. 同样的错误。 Was this module renamed or deleted? 该模块是否已重命名或删除? I haven't found any info about it in release notes or in commits. 我在发行说明或提交中没有找到任何关于它的信息。

Thanks for help! 感谢帮助!

It's no longer needed. 它不再需要了。 onTouchStart, onTouchEnd and onTouchMove are props of Views now. onTouchStart,onTouchEnd和onTouchMove现在是Views的道具。 Look here 看这里

I don't know, what really happened to this component. 我不知道,这个组件到底发生了什么。

But, at least, currently on RN 0.30 you can require ReactNativeEventEmitter as follows: 但是,至少目前在RN 0.30上,您可以按如下方式要求ReactNativeEventEmitter:

var ReactNativeEventEmitter=require(127);

The following line ... 以下行......

console.log(ReactNativeEventEmitter)

...will print then this in the console (in Debug-Mode): ...将在控制台中打印(在调试模式下):

在此输入图像描述

(I've figured it out while searching the react-native libraries in "node-modules" in the following file: "./node_modules/react-native/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js:13879", and it is also working under iOS [the screenshot above originates from iOS]). (我在下面的文件中搜索“node-modules”中的react-native库时已经弄明白了:“。/ node_modules / replace-term / OtherAndroid / src / androidTest / assets / AndroidTestBundle.js:13879”,以及它也在iOS下工作[上面的截图来自iOS])。

您是否尝试使用以下代码段导入?

import { DeviceEventEmitter } from 'react-native';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM