Add missing props to launchImageLibraryAsync
(cherry picked from commit 2e80ae561fd66850f787cac0aae0fa5a6980f8f5)
This commit is contained in:
committed by
Samuel Newman
parent
e5200c1146
commit
01687004ef
@@ -1,5 +1,9 @@
|
|||||||
import {useCallback} from 'react'
|
import {useCallback} from 'react'
|
||||||
import {type ImagePickerAsset, launchImageLibraryAsync} from 'expo-image-picker'
|
import {
|
||||||
|
type ImagePickerAsset,
|
||||||
|
launchImageLibraryAsync,
|
||||||
|
UIImagePickerPreferredAssetRepresentationMode,
|
||||||
|
} from 'expo-image-picker'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
@@ -15,6 +19,7 @@ import {
|
|||||||
import {getDataUriSize} from '#/lib/media/util'
|
import {getDataUriSize} from '#/lib/media/util'
|
||||||
import {isNative, isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {type ComposerImage, createComposerImage} from '#/state/gallery'
|
import {type ComposerImage, createComposerImage} from '#/state/gallery'
|
||||||
|
import {MAX_IMAGES} from '#/view/com/composer/state/composer'
|
||||||
import {getVideoMetadata} from '#/view/com/composer/videos/pickVideo'
|
import {getVideoMetadata} from '#/view/com/composer/videos/pickVideo'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button} from '#/components/Button'
|
import {Button} from '#/components/Button'
|
||||||
@@ -275,23 +280,22 @@ export function SelectMediaBtn({disabled, onAdd, onSelectVideo}: Props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//APiligrim
|
const {assets} = await sheetWrapper(
|
||||||
//Note: selectionLimit doesn't work reliably on Android, so we handle limiting in code
|
|
||||||
const response = await sheetWrapper(
|
|
||||||
launchImageLibraryAsync({
|
launchImageLibraryAsync({
|
||||||
exif: false,
|
exif: false,
|
||||||
mediaTypes: ['images', 'videos'],
|
mediaTypes: ['images', 'videos'],
|
||||||
quality: 1,
|
quality: 1,
|
||||||
allowsMultipleSelection: true,
|
allowsMultipleSelection: true,
|
||||||
legacy: true,
|
legacy: true,
|
||||||
|
selectionLimit: MAX_IMAGES,
|
||||||
|
preferredAssetRepresentationMode:
|
||||||
|
UIImagePickerPreferredAssetRepresentationMode.Current,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!response.assets || response.assets.length === 0) {
|
if (!assets || assets.length === 0) return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await processSelectedAssets(response.assets)
|
await processSelectedAssets(assets)
|
||||||
}, [
|
}, [
|
||||||
requestPhotoAccessIfNeeded,
|
requestPhotoAccessIfNeeded,
|
||||||
requestVideoAccessIfNeeded,
|
requestVideoAccessIfNeeded,
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ export const TextInput = forwardRef(function TextInputImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uris = files.map(f => f.uri)
|
const uris = files.map(f => f.uri)
|
||||||
|
// TODO
|
||||||
const uri = uris.find(isUriImage)
|
const uri = uris.find(isUriImage)
|
||||||
|
|
||||||
if (uri) {
|
if (uri) {
|
||||||
|
|||||||
Reference in New Issue
Block a user