Skip to content

Commit 8744676

Browse files
BackHandler works even if mounted after 'willFocus' (#16)
1 parent c11540b commit 8744676

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

BackHandler.android.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class BackHandlerAndroid extends React.Component {
88

99
constructor(props) {
1010
super(props);
11+
if (props.navigation.isFocused()) BackHandler.addEventListener('hardwareBackPress', this.onBackPressed);
1112
this._willFocusSubscription = props.navigation.addListener('willFocus', payload =>
1213
BackHandler.addEventListener('hardwareBackPress', this.onBackPressed)
1314
);

0 commit comments

Comments
 (0)