From 0ee9e3239dc95bb09644970f5e7ef08798b4a16f Mon Sep 17 00:00:00 2001 From: josemurillo10 Date: Sun, 28 May 2017 13:26:24 -0500 Subject: [PATCH] Update BackAndroid event for BackHandler React native 0.44 deprecated BackAndroid and changed it for BackHandler, in IOS this doesn't make a for a while until they remove it from react-native but in android its annoying show up a lot and it may be causing performance issues. --- src/menu/makeMenuContext.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/menu/makeMenuContext.js b/src/menu/makeMenuContext.js index e3a7900..18fc8e4 100644 --- a/src/menu/makeMenuContext.js +++ b/src/menu/makeMenuContext.js @@ -8,7 +8,7 @@ module.exports = (React, ReactNative, { constants, model, styles }) => { TouchableWithoutFeedback, ScrollView, View, - BackAndroid + BackHandler } = ReactNative; const AnimatedOptionsContainer = require('./makeAnimatedOptionsContainer')(React, ReactNative); @@ -149,8 +149,8 @@ module.exports = (React, ReactNative, { constants, model, styles }) => { } if (this.props.detectBackAndroid){ - BackAndroid.removeEventListener('hardwareBackPress', this.handleBackAndroid); //Override previous listener - BackAndroid.addEventListener('hardwareBackPress', this.handleBackAndroid); + BackHandler.removeEventListener('hardwareBackPress', this.handleBackAndroid); //Override previous listener + BackHandler.addEventListener('hardwareBackPress', this.handleBackAndroid); } this._menus[name] = hooks; },