allow gifs on native, just treat as images
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user