From a4e241a431076fc85574a6e12f332e6fac91de4a Mon Sep 17 00:00:00 2001 From: Menardi Date: Wed, 7 Feb 2024 10:51:24 +0000 Subject: [PATCH] fix: Fix photo not saving in example app on Android 13+ (#2522) On Android 13+, requesting the WRITE_EXTERNAL_STORAGE permission immediately denies, without asking the user. The @react-native-camera-roll/camera-roll plugin being used already supports using scoped storage for saving images on Android 13+, so this commit skips the permission check in that case, since no permissions are needed. --- package/example/src/MediaPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/example/src/MediaPage.tsx b/package/example/src/MediaPage.tsx index 93e3a14..1ddb760 100644 --- a/package/example/src/MediaPage.tsx +++ b/package/example/src/MediaPage.tsx @@ -14,7 +14,8 @@ import { useIsFocused } from '@react-navigation/core' import FastImage, { OnLoadEvent } from 'react-native-fast-image' const requestSavePermission = async (): Promise => { - if (Platform.OS !== 'android') return true + // On Android 13 and above, scoped storage is used instead and no permission is needed + if (Platform.OS !== 'android' || Platform.Version >= 33) return true const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE if (permission == null) return false