Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. Although everything I get this error on iOS, the app runs with no issue. But on Android, whenever I press the back button, the app crashes.

My assumption is that react native back button is conflicting with react-native-router-flux package.

Any help would be appreciated.

evaluating '_reactNative.BackHandler.addEventListener'

like image 730
Rene Midouin Avatar asked Sep 12 '25 13:09

Rene Midouin


1 Answers

Make sure you are importing BankHandler from react-native and not react, it should be

import { BackHandler } from 'react-native';

NOT

import { BackHandler } from 'react';

That was what caused the error for me :)

like image 133
Acheme Paul Avatar answered Sep 15 '25 01:09

Acheme Paul