diff options
author | Brian Kim <brian@tagg.id> | 2021-06-29 23:01:24 +0900 |
---|---|---|
committer | Brian Kim <brian@tagg.id> | 2021-06-29 23:01:24 +0900 |
commit | 014af4ac61bae6e38a4965ceb274b147ac3395c6 (patch) | |
tree | fc0a3ffac660607e24c5bc7a157d2fb8fbef94f2 /src | |
parent | 5480267b285812c094246bb941c6deaf83f53ff5 (diff) |
Construct and merge with master
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/Moment.tsx | 45 | ||||
-rw-r--r-- | src/components/moments/MomentPost.tsx | 4 |
2 files changed, 47 insertions, 2 deletions
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') ); /* |