[英]undefined is not an object (evaluating '_reactNative.BackHandler.addEventListener')
I am using react-native: 0.40 with react: 15.4.2 and react-native-router-flux: 3.37.0 and I've been getting this error. 我正在使用react-native:0.40 with react:15.4.2和react-native-router-flux:3.37.0并且我一直在收到此错误。 Although everything I get this error on iOS, the app runs with no issue.
虽然我在iOS上遇到此错误,但该应用程序运行时没有任何问题。 But on Android, whenever I press the back button, the app crashes.
但在Android上,每当我按下后退按钮时,应用程序都会崩溃。
My assumption is that react native back button is conflicting with react-native-router-flux package. 我的假设是本机后退按钮与react-native-router-flux包冲突。
Any help would be appreciated. 任何帮助,将不胜感激。
evaluating '_reactNative.BackHandler.addEventListener' 评估'_reactNative.BackHandler.addEventListener'
Try react-native@0.44.0 and react@16.0.0-alpha.6. 请尝试react-native@0.44.0和react@16.0.0-alpha.6。 I believe that this was fixed here: https://github.com/aksonov/react-native-router-flux/pull/1819
我相信这是在这里修复的: https : //github.com/aksonov/react-native-router-flux/pull/1819
I had the same error and after installing the above versions it works for me. 我有同样的错误,安装上述版本后,它适用于我。
Make sure you are importing BankHandler from react-native and not react, it should be 确保你从react-native导入BankHandler并且没有反应,它应该是
import { BackHandler } from 'react-native';
NOT 不
import { BackHandler } from 'react';
That was what caused the error for me :) 这就是导致我错误的原因:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.