From ca68554a22189f2b084aedc52d1b6360eac7b3ec Mon Sep 17 00:00:00 2001 From: Ahmad Igbaryya Date: Wed, 28 Jun 2023 13:31:53 +0300 Subject: [PATCH] WA for newier RN version. --- src/Router.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Router.js b/src/Router.js index 27c3402d9..fc7f72113 100644 --- a/src/Router.js +++ b/src/Router.js @@ -25,12 +25,16 @@ class App extends React.Component { // If the app was "woken up" by an external route. Linking.getInitialURL().then(url => this.parseDeepURL(url)); // Add an event listener for further deep linking. - Linking.addEventListener('url', this.handleDeepURL); + this.subscription = Linking.addEventListener('url', this.handleDeepURL); } componentWillUnmount() { BackHandler.removeEventListener('hardwareBackPress', this.props.backAndroidHandler || this.onBackPress); - Linking.removeEventListener('url', this.handleDeepURL); + if (typeof Linking.removeEventListener === 'function') { + Linking.removeEventListener('url', this.handleDeepURL); + } else if (this.subscription !== null) { + this.subscription.remove(); + } } onBackPress = () => navigationStore.pop();