* Fixes profile edit image selection not prompting users on web (#309) * Fixes linting erros
This commit is contained in:
parent
ea2b2583b8
commit
db6b198d18
3 changed files with 19 additions and 2 deletions
|
@ -2,6 +2,7 @@ import {Alert} from 'react-native'
|
|||
import {Camera} from 'expo-camera'
|
||||
import * as MediaLibrary from 'expo-media-library'
|
||||
import {Linking} from 'react-native'
|
||||
import {isWeb} from 'platform/detection'
|
||||
|
||||
const openSettings = () => {
|
||||
Linking.openURL('app-settings:')
|
||||
|
@ -24,6 +25,12 @@ const openPermissionAlert = (perm: string) => {
|
|||
export function usePhotoLibraryPermission() {
|
||||
const [mediaLibraryPermissions] = MediaLibrary.usePermissions()
|
||||
const requestPhotoAccessIfNeeded = async () => {
|
||||
// On the, we use <input type="file"> to produce a filepicker
|
||||
// This does not need any permission granting.
|
||||
if (isWeb) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (mediaLibraryPermissions?.status === 'granted') {
|
||||
return true
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue