Skip to content

Commit

Permalink
Change BackAndroid to BackHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean committed May 10, 2017
1 parent 54a8ac0 commit c5a3401
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/react-router-native/AndroidBackButton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { BackAndroid } from 'react-native'
import { BackHandler } from 'react-native'

class AndroidBackButton extends Component {
static contextTypes = {
Expand All @@ -13,11 +13,11 @@ class AndroidBackButton extends Component {
}

componentDidMount() {
BackAndroid.addEventListener('hardwareBackPress', this.handleBack)
BackHandler.addEventListener('hardwareBackPress', this.handleBack)
}

componentWillUnmount() {
BackAndroid.removeEventListener('hardwareBackPress', this.handleBack)
BackHandler.removeEventListener('hardwareBackPress', this.handleBack)
}

handleBack = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"peerDependencies": {
"react": "^15",
"react-native": ">=0.40"
"react-native": ">=0.44"
},
"dependencies": {
"prop-types": "^15.5.4",
Expand Down

0 comments on commit c5a3401

Please sign in to comment.