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 {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 {SUPPORTED_MIME_TYPES, type SupportedMimeTypes} from '#/lib/constants'
|
||||||
import {CompressedVideo} from './types'
|
import {type CompressedVideo} from './types'
|
||||||
import {extToMime} from './util'
|
import {extToMime} from './util'
|
||||||
|
|
||||||
const MIN_SIZE_FOR_COMPRESSION = 25 // 25mb
|
const MIN_SIZE_FOR_COMPRESSION = 25 // 25mb
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ enum SelectedAssetError {
|
|||||||
MaxVideos = 'MaxVideos',
|
MaxVideos = 'MaxVideos',
|
||||||
VideoTooLong = 'VideoTooLong',
|
VideoTooLong = 'VideoTooLong',
|
||||||
MaxGIFs = 'MaxGIFs',
|
MaxGIFs = 'MaxGIFs',
|
||||||
NoGifsOnNative = 'NoGifsOnNative',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +176,7 @@ function classifyImagePickerAsset(asset: ImagePickerAsset):
|
|||||||
* Distill this down into a type "class".
|
* Distill this down into a type "class".
|
||||||
*/
|
*/
|
||||||
let type: AssetType | undefined
|
let type: AssetType | undefined
|
||||||
if (mimeType === 'image/gif') {
|
if (isWeb && mimeType === 'image/gif') {
|
||||||
type = 'gif'
|
type = 'gif'
|
||||||
} else if (mimeType?.startsWith('video/')) {
|
} else if (mimeType?.startsWith('video/')) {
|
||||||
type = '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!
|
* All validations passed, we have an asset!
|
||||||
*/
|
*/
|
||||||
@@ -413,9 +405,6 @@ export function SelectMediaButton({
|
|||||||
[SelectedAssetError.MaxGIFs]: _(
|
[SelectedAssetError.MaxGIFs]: _(
|
||||||
msg`You can only select one GIF at a time.`,
|
msg`You can only select one GIF at a time.`,
|
||||||
),
|
),
|
||||||
[SelectedAssetError.NoGifsOnNative]: _(
|
|
||||||
msg`GIFs are only supported on web at this time.`,
|
|
||||||
),
|
|
||||||
}[error]
|
}[error]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -96,13 +96,12 @@ const ImageAltTextInner = ({
|
|||||||
<View style={[t.atoms.bg_contrast_50, a.rounded_sm, a.overflow_hidden]}>
|
<View style={[t.atoms.bg_contrast_50, a.rounded_sm, a.overflow_hidden]}>
|
||||||
<Image
|
<Image
|
||||||
style={imageStyle}
|
style={imageStyle}
|
||||||
source={{
|
source={{uri: (image.transformed ?? image.source).path}}
|
||||||
uri: (image.transformed ?? image.source).path,
|
|
||||||
}}
|
|
||||||
contentFit="contain"
|
contentFit="contain"
|
||||||
accessible={true}
|
accessible={true}
|
||||||
accessibilityIgnoresInvertColors
|
accessibilityIgnoresInvertColors
|
||||||
enableLiveTextInteraction
|
enableLiveTextInteraction
|
||||||
|
autoplay={false}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user