allow gifs on native, just treat as images

This commit is contained in:
Samuel Newman
2025-08-14 11:22:45 +03:00
parent 568c9397ff
commit 52136f47c5
3 changed files with 6 additions and 18 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
import {getVideoMetaData, Video} from 'react-native-compressor'
import {ImagePickerAsset} from 'expo-image-picker'
import {type ImagePickerAsset} from 'expo-image-picker'
import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants'
import {CompressedVideo} from './types'
import {SUPPORTED_MIME_TYPES, type SupportedMimeTypes} from '#/lib/constants'
import {type CompressedVideo} from './types'
import {extToMime} from './util'
const MIN_SIZE_FOR_COMPRESSION = 25 // 25mb
+1 -12
View File
@@ -60,7 +60,6 @@ enum SelectedAssetError {
MaxVideos = 'MaxVideos',
VideoTooLong = 'VideoTooLong',
MaxGIFs = 'MaxGIFs',
NoGifsOnNative = 'NoGifsOnNative',
}
/**
@@ -177,7 +176,7 @@ function classifyImagePickerAsset(asset: ImagePickerAsset):
* Distill this down into a type "class".
*/
let type: AssetType | undefined
if (mimeType === 'image/gif') {
if (isWeb && mimeType === 'image/gif') {
type = 'gif'
} else if (mimeType?.startsWith('video/')) {
type = 'video'
@@ -292,13 +291,6 @@ async function processImagePickerAssets(
}
}
if (type === 'gif') {
if (isNative) {
errors.add(SelectedAssetError.NoGifsOnNative)
continue
}
}
/*
* All validations passed, we have an asset!
*/
@@ -413,9 +405,6 @@ export function SelectMediaButton({
[SelectedAssetError.MaxGIFs]: _(
msg`You can only select one GIF at a time.`,
),
[SelectedAssetError.NoGifsOnNative]: _(
msg`GIFs are only supported on web at this time.`,
),
}[error]
})
@@ -96,13 +96,12 @@ const ImageAltTextInner = ({
<View style={[t.atoms.bg_contrast_50, a.rounded_sm, a.overflow_hidden]}>
<Image
style={imageStyle}
source={{
uri: (image.transformed ?? image.source).path,
}}
source={{uri: (image.transformed ?? image.source).path}}
contentFit="contain"
accessible={true}
accessibilityIgnoresInvertColors
enableLiveTextInteraction
autoplay={false}
/>
</View>
</View>