diff --git a/node_modules/react-native-modal/dist/modal.js b/node_modules/react-native-modal/dist/modal.js index ec3cc0b..bed08a4 100644 --- a/node_modules/react-native-modal/dist/modal.js +++ b/node_modules/react-native-modal/dist/modal.js @@ -52,6 +52,7 @@ export class ReactNativeModal extends React.Component { // isVisible prop to false. // We store in the state the device width and height so that we can update the modal on // device rotation. + this.dimensionsUpdateListener = null; this.state = { showContent: true, isVisible: false, @@ -448,7 +449,7 @@ export class ReactNativeModal extends React.Component { if (this.props.onSwipe) { console.warn('`` is deprecated and will be removed starting from 13.0.0. Use `` instead.'); } - DeviceEventEmitter.addListener('didUpdateDimensions', this.handleDimensionsUpdate); + this.dimensionsUpdateListener = DeviceEventEmitter.addListener('didUpdateDimensions', this.handleDimensionsUpdate); if (this.state.isVisible) { this.open(); } @@ -456,7 +457,7 @@ export class ReactNativeModal extends React.Component { } componentWillUnmount() { BackHandler.removeEventListener('hardwareBackPress', this.onBackButtonPress); - DeviceEventEmitter.removeListener('didUpdateDimensions', this.handleDimensionsUpdate); + this.dimensionsUpdateListener?.remove?.(); if (this.interactionHandle) { InteractionManager.clearInteractionHandle(this.interactionHandle); this.interactionHandle = null;