Skip to content

Commit

Permalink
fix: remove back press listener on unmount (#137)
Browse files Browse the repository at this point in the history
This should fix the #111, where one could do: `cond ? <Modalize ...> : null`, and a `cond=false` could cause the modalize to keep listening to back press events
  • Loading branch information
Grohden authored Feb 18, 2020
1 parent 9e4a6c2 commit eafb8ee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
}

componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
Keyboard.removeListener('keyboardDidShow', this.onKeyboardShow);
Keyboard.removeListener('keyboardDidHide', this.onKeyboardHide);
}
Expand Down

0 comments on commit eafb8ee

Please sign in to comment.