The problem for my application is when user denies the access to media library for the first time then when he comes back and tries to upload a photo from phone the device doesn't ask again du you want to allow this app to enter in your media library, this problem is only in IOS because in Android i can fix it with this:
import {PermissionsAndroid} from 'react-native';
This is how permissions work in iOS and there is no way to actually get the app to request the permission again once it has been denied. The only way to get the user to enable the permission is to direct them to the settings for their application and manually switch it on.
I do the following for permissions.
I use react-native-permissions
to check and request the permissions that I need in iOS. https://github.com/zoontek/react-native-permissions
You can then use the open-settings
capability of react-native-permissions
to open the settings page https://github.com/zoontek/react-native-permissions#opensettings
This requires require modifying native code, so depending on your Expo setup it may not work.
I also use Redux (you may be able to use AsyncStorage) in my application and I track the AppState. So I know when the user has come back to the app from the settings screen so I can perform any appropriate actions in the application (like check the permission again, open the media library, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With