aboutsummaryrefslogtreecommitdiff
path: root/src/screens/moments/TagFriendsScreen.tsx
diff options
context:
space:
mode:
authorMichael <michael.foiani@gmail.com>2021-08-02 11:41:51 -0400
committerMichael <michael.foiani@gmail.com>2021-08-02 11:41:51 -0400
commite3f8180e24b35eccdb49fe766b9e1fe10c33da3f (patch)
tree1841dda83317d0b3ac922691493197aacb036677 /src/screens/moments/TagFriendsScreen.tsx
parentcf2a5b7294ed3c51898febf393a50108e2b9825d (diff)
parent452f3fb44838c367f40e8aa57db2e274a357afd2 (diff)
Pull from master
Diffstat (limited to 'src/screens/moments/TagFriendsScreen.tsx')
-rw-r--r--src/screens/moments/TagFriendsScreen.tsx104
1 files changed, 34 insertions, 70 deletions
diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx
index d11f8049..c55721ed 100644
--- a/src/screens/moments/TagFriendsScreen.tsx
+++ b/src/screens/moments/TagFriendsScreen.tsx
@@ -10,15 +10,13 @@ import {
View,
} from 'react-native';
import Video from 'react-native-video';
-import {MainStackParams} from 'src/routes';
-import BackArrow from '../../assets/icons/back-arrow.svg';
import {MomentTags} from '../../components';
import {TagFriendsFooter} from '../../components/moments';
+import {headerBarOptions, MainStackParams} from '../../routes';
import {MomentTagType} from '../../types';
import {
HeaderHeight,
isIPhoneX,
- normalize,
SCREEN_HEIGHT,
SCREEN_WIDTH,
} from '../../utils';
@@ -48,6 +46,36 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
setTags(selectedTags ? selectedTags : []);
}, [selectedTags]);
+ useEffect(() => {
+ const title = media.isVideo
+ ? ''
+ : tags.length === 0
+ ? 'Tap on photo to tag friends!'
+ : 'Press and drag to move';
+ navigation.setOptions({
+ ...headerBarOptions('white', title),
+ headerRight: () => (
+ <TouchableOpacity
+ style={styles.buttonContainer}
+ // Altering the opacity style of TouchableOpacity doesn't work,
+ // so the next two lines are needed
+ disabled={tags.length === 0}
+ activeOpacity={tags.length === 0 ? 0 : 1}
+ onPress={handleDone}>
+ <Text
+ style={[
+ styles.shareButtonTitle,
+ // makes the Done buttomn invisible if there are no tags
+ // eslint-disable-next-line react-native/no-inline-styles
+ {opacity: tags.length !== 0 ? 1 : 0},
+ ]}>
+ Done
+ </Text>
+ </TouchableOpacity>
+ ),
+ });
+ }, [tags]);
+
/*
* Navigate back to Tag Users Screen, send selected users
*/
@@ -174,49 +202,8 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
onLayout={(event) => {
const {y, height} = event.nativeEvent.layout;
setTopHeight(y + height);
- }}>
- <TouchableOpacity
- onPress={() => {
- navigation.goBack();
- }}
- style={styles.backArrow}>
- <View style={styles.backArrowContainer}>
- <BackArrow
- height={normalize(18)}
- width={normalize(18)}
- color={'white'}
- />
- </View>
- </TouchableOpacity>
- {!media.isVideo ? (
- <TouchableWithoutFeedback style={styles.headerContainer}>
- {tags.length === 0 ? (
- <Text style={styles.header}>Tap on photo to tag friends!</Text>
- ) : (
- <Text style={styles.header}>Press and drag to move</Text>
- )}
- </TouchableWithoutFeedback>
- ) : (
- <View style={styles.headerPlaceholder} />
- )}
- <TouchableOpacity
- style={styles.buttonContainer}
- // Altering the opacity style of TouchableOpacity doesn't work,
- // so the next two lines are needed
- disabled={tags.length === 0}
- activeOpacity={tags.length === 0 ? 0 : 1}
- onPress={handleDone}>
- <Text
- style={[
- styles.shareButtonTitle,
- // makes the Done buttomn invisible if there are no tags
- // eslint-disable-next-line react-native/no-inline-styles
- {opacity: tags.length !== 0 ? 1 : 0},
- ]}>
- Done
- </Text>
- </TouchableOpacity>
- </View>
+ }}
+ />
{tags.length !== 0 && !media.isVideo && (
<MomentTags
tags={tags}
@@ -244,34 +231,11 @@ const styles = StyleSheet.create({
height: SCREEN_HEIGHT,
alignContent: 'center',
},
- backArrow: {
- marginTop: isIPhoneX() ? HeaderHeight : '10%',
- zIndex: 9999,
- },
- backArrowContainer: {
- flex: 1,
- flexDirection: 'column',
- justifyContent: 'center',
- alignContent: 'center',
- },
button: {
zIndex: 9999,
},
buttonContainer: {
- marginTop: isIPhoneX() ? HeaderHeight : '10%',
- right: 0,
- zIndex: 9999,
- flexDirection: 'row',
- justifyContent: 'flex-end',
- },
- headerContainer: {
- width: SCREEN_WIDTH,
- flexDirection: 'row',
- justifyContent: 'center',
- zIndex: 9999,
- },
- headerPlaceholder: {
- width: SCREEN_WIDTH * 0.5,
+ right: 20,
},
shareButtonTitle: {
fontWeight: 'bold',