Am I doing Linking right? Handler gets called three times


#1

I’m trying to setup an OAuth workflow in an ExpoKit app (tried SDK 31 and 32). While documenting this issue (https://github.com/expo/expo/issues/3432), I noticed something else odd with Linking.

I setup an example at: https://github.com/llamaluvr/testandroidlinking. To run it:
a) download/ restore deps
b) run in Android Studio

It’s very similar to this example (https://github.com/expo/examples/blob/master/with-webbrowser-redirect/app/App.js), except that I added console logging.

Try the openWebBrowserAsync() button let it finish redirecting, and watch the console. It will look like this:

[12:56:43] Linking is listening!
[12:56:52] Redirect handled!
[12:56:52] Redirect handled!
[12:56:52] Redirect handled!
[12:56:52] Linking is not listening!

So, it the linking handler gets called three times. I’ve tried removing some intent filters that might be matching in AndroidManifest.xml, but it still gets called three times. I can tell it’s not an issue of it being registered too many times- even if I move registering the listener to componentDidMount(), it still gets called three times. Anyway, wondering if there’s a way to only get that to happen once.

Thanks!