Skip to content

Commit e833a78

Browse files
jrapaladavidLeonardi
authored andcommitted
Replace BackAndroid with BackHandler (#174)
1 parent 80a49aa commit e833a78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/NavBarContainer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import {
4-
BackAndroid,
4+
BackHandler,
55
Platform,
66
StyleSheet,
77
Text,
@@ -68,7 +68,7 @@ class NavBarContainer extends React.Component {
6868

6969
componentDidMount() {
7070
if (Platform.OS === 'android' && !!this.props.handleBackAndroid) {
71-
BackAndroid.addEventListener('hardwareBackPress', () => {
71+
BackHandler.addEventListener('hardwareBackPress', () => {
7272
if (this.props.currentRoute.index > 0) {
7373
this.goBack();
7474
return true;
@@ -89,7 +89,7 @@ class NavBarContainer extends React.Component {
8989

9090
componentWillUnmount() {
9191
if (Platform.OS === 'android' && !!this.props.handleBackAndroid) {
92-
BackAndroid.removeEventListener('hardwareBackPress');
92+
BackHandler.removeEventListener('hardwareBackPress');
9393
}
9494
}
9595

0 commit comments

Comments
 (0)