Problem with openBrowserAsync and input type file

I’m opening a browser with WebBrowser.openBrowserAsync to send the user to a web page where they can upload a file (due to limitations with WebViews and fileinputs on Android). The problem is once the user taps on the file select input and the menu to select Camera or Documents comes up, they will get redirected back to the app once they close the menu or select an item, as if they had closed the browser.

Here’s a GIF of what happens when I cancel by tapping outside of the menu. The same happens if I select a file:

CloudApp

That’s the same behavior I see if I close the browser tab before picking a file. This does not happen on iOS.

The file picker works as expected if I used Linking.openURL instead.

Any help would be appreciated. Thanks!

I’ve managed to reproduce the issue and looking into a fix. Thanks for the detailed report!

Hey Janic!

I see this has been released on v18.0.0! Nice! Thanks a lot.

Sorry to necro this but i’m currently having exactly this issue and this is the only thread i can find addressing it.

Your snack works for me in the Web preview (Firefox complained that snack.expo.io wanted to open a popup), on an Android phone and on an iPad.

I did change the URL to https://www.google.com, though.

How did you test? What devices/simulators/emulators? What happened? Using an http URL could potentially be a problem (I think especially on iOS). If I remember correctly you need to tell iOS which domains you want to be able to connect to via http instead of https.

Actually, I’ve tried it again using http://www.google.com and that works too.

You have to open it with an android device/emulator to see the issue (since it works on web and iOS). Opening the webpage is not the issue - but opening and then closing (or selecting a file) with a <input type='file'> html element is where the issue is at. After closing the file browser the webpage is closed for no apparent reason and we are return to the previous app context.

So, to recreate it: Run the snack with and android device. Keep the URL i provided (it’s a simple html view with a file input) and click the “choose file” button. Then choose a file in the file browser.

Sorry for the misunderstanding. Yes, I confirm I’m seeing the same thing on Android. I suggest you create an issue at https://github.com/expo/expo/issues.