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.
This commit is contained in:
parent
3192f5e939
commit
a4e241a431
@ -14,7 +14,8 @@ import { useIsFocused } from '@react-navigation/core'
|
|||||||
import FastImage, { OnLoadEvent } from 'react-native-fast-image'
|
import FastImage, { OnLoadEvent } from 'react-native-fast-image'
|
||||||
|
|
||||||
const requestSavePermission = async (): Promise<boolean> => {
|
const requestSavePermission = async (): Promise<boolean> => {
|
||||||
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
|
const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
|
||||||
if (permission == null) return false
|
if (permission == null) return false
|
||||||
|
Loading…
Reference in New Issue
Block a user