- SDK Version: 42
- Platforms(Android/iOS/web/all): Android
- expo-linking 2.3.1 / expo-web-browser 9.2.0
Hi,
I’m facing a weird issue, where Linking.removeEventListener
is fired but does not remove the listener. At the end of my WebBrowser.openBrowserAsync
, the listener create with Linking.addEventListener
, is stacking on my components, and the first time I call this I got one event fired, and the second time, I got two events fired …
Here a sample of my code:
_handleWebSecureAsync = async (urlGo) => {
this._addLinkingListener();
let result = await WebBrowser.openBrowserAsync(`${urlGo}`);
};
eventLinking(url) {
this._handleRedirect(url)
}
_addLinkingListener = () => {
Linking.addEventListener('url', this.eventLinking.bind(this));
};
_removeLinkingListener = () => {
Linking.removeEventListener('url', this.eventLinking.bind(this));
};
_handleRedirect (event) {
if (Platform.OS === 'ios') WebBrowser.dismissBrowser();
else this._removeLinkingListener();
let data = Linking.parse(event.url);
this.handleVerifEndCheckout(data['queryParams'])
};
I followed the documentation and this tutorial. But it’s not working as expected.
So if I’m making one call on my function _handleWebSecureAsync
it’s ok, but if I’m doing two call (one after the other, with some time between), the handler of linking is fired twice at the same time, and I can’t manage to cut the second if the first is in progress because they are fired at the same exact time. That’s why I think it’s the Linking.removeEventListener
that is not doing is job.
I tried to cut all other call in front, and on my backend, but nothing to so, they are so in the same timing that I can’t control them…
Hope someone can help me, it’s REALLY annoying!
Thanks in advance, have a good day!