diff options
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | src/components/moments/Moment.tsx | 45 | ||||
-rw-r--r-- | src/components/moments/MomentPost.tsx | 4 |
3 files changed, 49 insertions, 4 deletions
diff --git a/package.json b/package.json index 09ed6fc5..e28fc214 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "react-native-haptic-feedback": "^1.11.0", "react-native-hyperlink": "^0.0.19", "react-native-image-crop-picker": "^0.36.0", - "react-native-image-picker": "^4.0.4", "react-native-image-pan-zoom": "^2.1.12", + "react-native-image-picker": "^4.0.4", "react-native-image-resizer": "^1.4.4", "react-native-inappbrowser-reborn": "^3.5.0", "react-native-linear-gradient": "^2.5.6", @@ -110,4 +110,4 @@ "./node_modules/react-native-gesture-handler/jestSetup.js" ] } -}
\ No newline at end of file +} diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index a43a2830..04d35825 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -91,7 +91,14 @@ const Moment: React.FC<MomentProps> = ({ mediaType: 'any', }) .then((picture) => { - if (picture.path && picture.filename) { + if ( + (picture.filename.endsWith('gif') || + picture.filename.endsWith('GIF')) && + picture.path && + picture.filename + ) { + showAlert(picture); + } else if (picture.path && picture.filename) { navigation.navigate('ZoomInCropper', { screenType, title, @@ -110,6 +117,42 @@ const Moment: React.FC<MomentProps> = ({ }); }; + /* Handles GIF files */ + const showAlert = (picture) => + Alert.alert( + 'Warning', + 'The cropped image will not be a GIF, but will only include the first frame of the GIF. Continue?', + [ + { + text: 'Cancel', + onPress: () => {}, + style: 'cancel', + }, + { + text: 'Continue', + onPress: () => { + navigation.navigate('ZoomInCropper', { + screenType, + title, + media: { + filename: picture.filename, + uri: picture.path, + isVideo: false, + }, + }); + }, + style: 'default', + }, + ], + { + cancelable: true, + onDismiss: () => + Alert.alert( + 'This alert was dismissed by tapping outside of the alert dialog.', + ), + }, + ); + return ( <View style={[styles.container, externalStyles?.container]}> <View style={[styles.header, externalStyles?.header]}> diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx index cb3a138b..f5a256d6 100644 --- a/src/components/moments/MomentPost.tsx +++ b/src/components/moments/MomentPost.tsx @@ -78,7 +78,9 @@ const MomentPost: React.FC<MomentPostProps> = ({ moment.moment_url.endsWith('jpg') || moment.moment_url.endsWith('JPG') || moment.moment_url.endsWith('PNG') || - moment.moment_url.endsWith('png') + moment.moment_url.endsWith('png') || + moment.moment_url.endsWith('GIF') || + moment.moment_url.endsWith('gif') ); /* |