From 73a77690fa1dd0737f0226e08b19001bc0d676a3 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Wed, 7 Jul 2021 17:39:19 -0400 Subject: Basic functionality --- src/screens/moments/TagFriendsScreen.tsx | 159 +++++++++++++++++++++---------- 1 file changed, 110 insertions(+), 49 deletions(-) (limited to 'src/screens') diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx index 201caf49..25105e6c 100644 --- a/src/screens/moments/TagFriendsScreen.tsx +++ b/src/screens/moments/TagFriendsScreen.tsx @@ -1,10 +1,12 @@ import {RouteProp} from '@react-navigation/core'; import {useNavigation} from '@react-navigation/native'; -import React, {useEffect, useRef, useState} from 'react'; +import React, {useCallback, useEffect, useRef, useState} from 'react'; import {Image, StyleSheet, TouchableWithoutFeedback, View} from 'react-native'; +import {useFocusEffect} from '@react-navigation/native'; import {Button} from 'react-native-elements'; import Video from 'react-native-video'; import {MainStackParams} from 'src/routes'; +import BackArrow from '../../assets/icons/back-arrow.svg'; import { CaptionScreenHeader, MomentTags, @@ -13,7 +15,14 @@ import { import {TagFriendsFooter} from '../../components/moments'; import {TAGG_LIGHT_BLUE_2} from '../../constants'; import {MomentTagType} from '../../types'; -import {SCREEN_WIDTH, StatusBarHeight} from '../../utils'; +import { + SCREEN_WIDTH, + StatusBarHeight, + SCREEN_HEIGHT, + HeaderHeight, + isIPhoneX, +} from '../../utils'; +import {TouchableOpacity} from 'react-native-gesture-handler'; type TagFriendsScreenRouteProps = RouteProp< MainStackParams, @@ -37,6 +46,22 @@ const TagFriendsScreen: React.FC = ({route}) => { setTags(selectedTags ? selectedTags : []); }, [selectedTags]); + /* + * Hide Tab Bar + */ + useFocusEffect( + useCallback(() => { + navigation.dangerouslyGetParent()?.setOptions({ + tabBarVisible: false, + }); + return () => { + navigation.dangerouslyGetParent()?.setOptions({ + tabBarVisible: true, + }); + }; + }, [navigation]), + ); + /* * Navigate back to Tag Users Screen, send selected users */ @@ -49,16 +74,17 @@ const TagFriendsScreen: React.FC = ({route}) => { const setMediaDimensions = (width: number, height: number) => { const imageAspectRatio = width / height; + const screenRatio = SCREEN_WIDTH / SCREEN_HEIGHT; // aspectRatio: >= 1 [Landscape] [1:1] - if (imageAspectRatio >= 1) { + if (imageAspectRatio >= screenRatio) { setImageWidth(SCREEN_WIDTH); setImageHeight(SCREEN_WIDTH / imageAspectRatio); } // aspectRatio: < 1 [Portrait] - if (imageAspectRatio < 1) { - setImageHeight(SCREEN_WIDTH); - setImageWidth(SCREEN_WIDTH * imageAspectRatio); + if (imageAspectRatio < screenRatio) { + setImageHeight(SCREEN_HEIGHT); + setImageWidth(SCREEN_HEIGHT * imageAspectRatio); } }; @@ -78,25 +104,12 @@ const TagFriendsScreen: React.FC = ({route}) => { }, []); return ( - - - -