aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/moments/Moment.tsx8
-rw-r--r--src/routes/main/MainStackNavigator.tsx3
-rw-r--r--src/screens/profile/CaptionScreen.tsx8
3 files changed, 11 insertions, 8 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx
index 34b2c7ea..a0f66cc5 100644
--- a/src/components/moments/Moment.tsx
+++ b/src/components/moments/Moment.tsx
@@ -102,11 +102,15 @@ const Moment: React.FC<MomentProps> = ({
mediaType: 'photo',
})
.then((picture) => {
- if ('path' in picture) {
+ if (picture.path && picture.filename) {
navigation.navigate('CaptionScreen', {
screenType,
title: title,
- image: picture,
+ media: {
+ filename: picture.filename,
+ uri: picture.path,
+ type: 'image',
+ },
});
}
})
diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx
index 8fce5e2f..8157f0d7 100644
--- a/src/routes/main/MainStackNavigator.tsx
+++ b/src/routes/main/MainStackNavigator.tsx
@@ -2,7 +2,6 @@
* Note the name userXId here, it refers to the id of the user being visited
*/
import {createStackNavigator} from '@react-navigation/stack';
-import {Image} from 'react-native-image-crop-picker';
import {
CommentBaseType,
MomentTagType,
@@ -38,7 +37,7 @@ export type MainStackParams = {
};
CaptionScreen: {
title?: string;
- image?: Image;
+ media?: {filename: string; uri: string; type: 'image' | 'video'};
screenType: ScreenType;
selectedTags?: MomentTagType[];
moment?: MomentType;
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 9e1b4674..bb02494d 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -51,7 +51,7 @@ interface CaptionScreenProps {
}
const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
- const {title, image, screenType, selectedTags, moment} = route.params;
+ const {title, media, screenType, selectedTags, moment} = route.params;
const {
user: {userId},
} = useSelector((state: RootState) => state.user);
@@ -120,12 +120,12 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const handleShare = async () => {
setLoading(true);
- if (!image?.filename || !title) {
+ if (!media || !title) {
return;
}
const momentResponse = await postMoment(
- image.filename,
- image.path,
+ media.filename,
+ media.uri,
caption,
title,
userId,