Skip to content

Commit a4e241a

Browse files
authored
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.
1 parent 3192f5e commit a4e241a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

package/example/src/MediaPage.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { useIsFocused } from '@react-navigation/core'
1414
import FastImage, { OnLoadEvent } from 'react-native-fast-image'
1515

1616
const requestSavePermission = async (): Promise<boolean> => {
17-
if (Platform.OS !== 'android') return true
17+
// On Android 13 and above, scoped storage is used instead and no permission is needed
18+
if (Platform.OS !== 'android' || Platform.Version >= 33) return true
1819

1920
const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
2021
if (permission == null) return false

0 commit comments

Comments
 (0)