File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
package/expo-package/src/optionalDependencies Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1+ import { Platform } from 'react-native' ;
12let ImagePicker ;
23
34try {
@@ -15,15 +16,18 @@ if (!ImagePicker) {
1516export const pickImage = ImagePicker
1617 ? async ( ) => {
1718 try {
18- const permissionCheck = await ImagePicker . getMediaLibraryPermissionsAsync ( ) ;
19- const canRequest = permissionCheck . canAskAgain ;
20- let permissionGranted = permissionCheck . granted ;
21- if ( ! permissionGranted ) {
22- if ( canRequest ) {
23- const response = await ImagePicker . requestMediaLibraryPermissionsAsync ( ) ;
24- permissionGranted = response . granted ;
25- } else {
26- return { askToOpenSettings : true , cancelled : true } ;
19+ let permissionGranted = true ;
20+ if ( Platform . OS === 'ios' ) {
21+ const permissionCheck = await ImagePicker . getMediaLibraryPermissionsAsync ( ) ;
22+ const canRequest = permissionCheck . canAskAgain ;
23+ permissionGranted = permissionCheck . granted ;
24+ if ( ! permissionGranted ) {
25+ if ( canRequest ) {
26+ const response = await ImagePicker . requestMediaLibraryPermissionsAsync ( ) ;
27+ permissionGranted = response . granted ;
28+ } else {
29+ return { askToOpenSettings : true , cancelled : true } ;
30+ }
2731 }
2832 }
2933 if ( permissionGranted ) {
You can’t perform that action at this time.
0 commit comments