aboutsummaryrefslogtreecommitdiff
path: root/src/components/moments/Moment.tsx
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2021-01-16 09:51:36 -0800
committerGitHub <noreply@github.com>2021-01-16 09:51:36 -0800
commit9711093bfa5810868e3cd17008bb7b3ddc7b9034 (patch)
tree6a8bb4341b1623cfc2da86af4b3b28c1fd3f8a44 /src/components/moments/Moment.tsx
parentd85eaeb878cbbeedda860ee5809b81100c910af2 (diff)
parent30391867438bb28cbcba9fc9ee2ff6d00027fd86 (diff)
Merge branch 'master' into tma538-friend-requests
Diffstat (limited to 'src/components/moments/Moment.tsx')
-rw-r--r--src/components/moments/Moment.tsx52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx
index 623e328d..7905e8a9 100644
--- a/src/components/moments/Moment.tsx
+++ b/src/components/moments/Moment.tsx
@@ -1,27 +1,20 @@
import {useNavigation} from '@react-navigation/native';
-import React from 'react';
-import {
- Alert,
- StyleProp,
- StyleSheet,
- View,
- ViewProps,
- ViewStyle,
-} from 'react-native';
+import React, {Fragment} from 'react';
+import {Alert, StyleProp, StyleSheet, View, ViewStyle} from 'react-native';
import {Text} from 'react-native-animatable';
import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler';
+import ImagePicker from 'react-native-image-crop-picker';
import LinearGradient from 'react-native-linear-gradient';
-import PlusIcon from '../../assets/icons/plus_icon-01.svg';
-import UpIcon from '../../assets/icons/up_icon.svg';
-import DownIcon from '../../assets/icons/down_icon.svg';
+import {MomentType, ScreenType} from 'src/types';
import DeleteIcon from '../../assets/icons/delete-logo.svg';
+import DownIcon from '../../assets/icons/down_icon.svg';
+import PlusIcon from '../../assets/icons/plus_icon-01.svg';
import BigPlusIcon from '../../assets/icons/plus_icon-02.svg';
+import UpIcon from '../../assets/icons/up_icon.svg';
import {TAGG_TEXT_LIGHT_BLUE} from '../../constants';
+import {ERROR_UPLOAD_MOMENT_SHORT} from '../../constants/strings';
import {SCREEN_WIDTH} from '../../utils';
-import ImagePicker from 'react-native-image-crop-picker';
import MomentTile from './MomentTile';
-import {MomentType, ScreenType} from 'src/types';
-import {useDispatch} from 'react-redux';
interface MomentProps {
title: string;
@@ -49,7 +42,6 @@ const Moment: React.FC<MomentProps> = ({
externalStyles,
}) => {
const navigation = useNavigation();
- const dispatch = useDispatch();
const navigateToImagePicker = () => {
ImagePicker.openPicker({
@@ -77,7 +69,7 @@ const Moment: React.FC<MomentProps> = ({
})
.catch((err) => {
if (err.code && err.code !== 'E_PICKER_CANCELLED') {
- Alert.alert('Unable to upload moment!');
+ Alert.alert(ERROR_UPLOAD_MOMENT_SHORT);
}
});
};
@@ -88,23 +80,15 @@ const Moment: React.FC<MomentProps> = ({
<Text style={[styles.titleText, externalStyles?.titleText]}>
{title}
</Text>
- <View style={styles.flexer} />
{!userXId ? (
<>
- <PlusIcon
- width={21}
- height={21}
- onPress={() => navigateToImagePicker()}
- color={TAGG_TEXT_LIGHT_BLUE}
- style={{marginRight: 10}}
- />
{showUpButton && move && (
<UpIcon
width={19}
height={19}
onPress={() => move('up', title)}
color={TAGG_TEXT_LIGHT_BLUE}
- style={{marginRight: 10}}
+ style={{marginLeft: 5}}
/>
)}
{showDownButton && move && (
@@ -113,9 +97,23 @@ const Moment: React.FC<MomentProps> = ({
height={19}
onPress={() => move('down', title)}
color={TAGG_TEXT_LIGHT_BLUE}
- style={{marginRight: 10}}
+ style={{marginLeft: 5}}
/>
)}
+ </>
+ ) : (
+ <Fragment />
+ )}
+ <View style={styles.flexer} />
+ {!userXId ? (
+ <>
+ <PlusIcon
+ width={21}
+ height={21}
+ onPress={() => navigateToImagePicker()}
+ color={TAGG_TEXT_LIGHT_BLUE}
+ style={{marginRight: 10}}
+ />
{shouldAllowDeletion && (
<DeleteIcon
onPress={() => handleMomentCategoryDelete(title)}