aboutsummaryrefslogtreecommitdiff
path: root/src/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/profile/CaptionScreen.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 15566555..9a1878aa 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -20,13 +20,12 @@ import {useDispatch, useSelector} from 'react-redux';
import FrontArrow from '../../assets/icons/front-arrow.svg';
import {
MentionInputControlled,
- MomentPostButton,
SearchBackground,
TaggSquareButton,
} from '../../components';
import {CaptionScreenHeader} from '../../components/';
import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator';
-import {TAGG_LIGHT_BLUE, TAGG_LIGHT_BLUE_2} from '../../constants';
+import {TAGG_LIGHT_BLUE_2} from '../../constants';
import {
ERROR_NO_MOMENT_CATEGORY,
ERROR_SOMETHING_WENT_WRONG_REFRESH,
@@ -66,7 +65,8 @@ interface CaptionScreenProps {
}
const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
- const {screenType, moment} = route.params;
+ // moment is only present when editing
+ const {moment} = route.params;
const {
user: {userId},
} = useSelector((state: RootState) => state.user);
@@ -205,12 +205,13 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
handleSuccess();
};
- const handleDoneEditing = async () => {
+ const handleSubmitEditChanges = async () => {
setLoading(true);
- if (moment?.moment_id) {
+ if (moment?.moment_id && momentCategory) {
const success = await patchMoment(
moment.moment_id,
caption,
+ momentCategory,
formattedTags(),
);
if (success) {
@@ -315,8 +316,8 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
/>
{momentCategory ? (
<TaggSquareButton
- onPress={moment ? handleDoneEditing : handleShare}
- title={'Post'}
+ onPress={moment ? handleSubmitEditChanges : handleShare}
+ title={moment ? 'Update' : 'Post'}
buttonStyle={'large'}
buttonColor={'blue'}
labelColor={'white'}
@@ -326,8 +327,8 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
) : (
<TaggSquareButton
disabled={true}
- onPress={moment ? handleDoneEditing : handleShare}
- title={'Post'}
+ onPress={moment ? handleSubmitEditChanges : handleShare}
+ title={moment ? 'Update' : 'Post'}
buttonStyle={'large'}
buttonColor={'blue'}
labelColor={'white'}