Skip to content

feat(android): open the system document picker for <input type="file"> - #39

Open
modos189 wants to merge 1 commit into
nativescript-community:masterfrom
modos189:feat/android-file-input
Open

modos189 wants to merge 1 commit into
nativescript-community:masterfrom
modos189:feat/android-file-input

Conversation

@modos189

@modos189 modos189 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

On Android a file input in the WebView couldn't be used. Without a fileChooser listener, tapping it opened nothing and the page got an immediate cancel. With a listener the picker opened, but the chosen files never reached the page: the URI array was built but never passed to onReceiveValue, and content:// URIs were rewritten as file:// paths. After that the input stopped responding until the WebView was recreated. iOS isn't affected, since WKWebView shows its own picker.

The WebView now opens the system document picker (ACTION_OPEN_DOCUMENT) itself and passes the chosen content:// URIs to the page. The page gets the real name, type and content without any storage permission and without a new dependency. accept becomes the picker's MIME filter. An extension with no known type, like .gpx, shows all files instead of hiding the ones the page accepts. multiple enables multi-select. If the view is disposed while the picker is open, the page gets a cancel. The undocumented fileChooser event is removed, since it never delivered a result. A TODO marks where an app-provided picker could be plugged in later, as with the popup presenter in #29.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant