react-native-file-selector
react-native-file-selector copied to clipboard
[Android] Permission is asked behind the selection view
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Memory: 1.01 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.2 - ~/.nvm/versions/node/v8.11.2/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.2/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 17, 21, 23, 25, 26, 27
Build Tools: 23.0.1, 23.0.3, 24.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.2, 28.0.3
System Images: android-25 | Google APIs Intel x86 Atom_64
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8
"lodash": "^4.17.11",
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-file-selector": "^0.0.6",
Description
When I make the RNFileSelector appear for the first time the permission is asked to access the files but the pop-up is located under the file selector which show an empty list cause we don't have access till the user gives the permission. So after closing the view we can accept and then go to the list now full
Reproducible Demo
Just have a button that show (turn visible to true) and this code
<RNFileSelector
title="Select File"
visible
onDone={(url) => {
this.setState({
visible: false,
});
}}
onCancel={() => {
console.log('cancelled');
this.setState({
visible: false,
});
}}
Thanks a lot
same issue here
I can replicate this too. on any fresh install where permissions haven't been granted yet.
Checking for read permission before showing was what fixed it for me.
See https://github.com/prscX/react-native-file-selector/issues/11#issuecomment-428352128