aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/moments/MomentPost.tsx2
-rw-r--r--src/screens/profile/CaptionScreen.tsx25
2 files changed, 19 insertions, 8 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index e744fcd9..b659177d 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -40,7 +40,7 @@ const MomentPost: React.FC<MomentPostProps> = ({item, userXId, screenType}) => {
*/
useEffect(() => {
loadTags();
- }, []);
+ }, [item]);
/*
* Check if loggedInUser has been tagged in the picture and set the id
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 949b61fd..9e1b4674 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -21,7 +21,11 @@ import {SearchBackground} from '../../components';
import {CaptionScreenHeader} from '../../components/';
import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator';
import {TAGG_LIGHT_BLUE_2} from '../../constants';
-import {ERROR_UPLOAD, SUCCESS_PIC_UPLOAD} from '../../constants/strings';
+import {
+ ERROR_SOMETHING_WENT_WRONG_REFRESH,
+ ERROR_UPLOAD,
+ SUCCESS_PIC_UPLOAD,
+} from '../../constants/strings';
import {MainStackParams} from '../../routes';
import {patchMoment, postMoment, postMomentTags} from '../../services';
import {
@@ -89,15 +93,20 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const handleFailed = () => {
setLoading(false);
setTimeout(() => {
- Alert.alert(moment ? 'Error editing moment' : ERROR_UPLOAD);
+ Alert.alert(moment ? ERROR_SOMETHING_WENT_WRONG_REFRESH : ERROR_UPLOAD);
}, 500);
};
const handleSuccess = () => {
setLoading(false);
- navigateToProfile();
- setTimeout(() => {
- Alert.alert(moment ? 'Successfully edited moment!' : SUCCESS_PIC_UPLOAD);
- }, 500);
+ if (moment) {
+ setLoading(false);
+ navigation.goBack();
+ } else {
+ navigateToProfile();
+ setTimeout(() => {
+ Alert.alert(SUCCESS_PIC_UPLOAD);
+ }, 500);
+ }
};
const formattedTags = () => {
@@ -169,7 +178,9 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
<Button
title="Cancel"
buttonStyle={styles.button}
- onPress={() => navigateToProfile()}
+ onPress={() =>
+ moment ? navigation.goBack() : navigateToProfile()
+ }
/>
<Button
title={moment ? 'Done' : 'Share'}