aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-23 20:05:54 -0400
committerGitHub <noreply@github.com>2021-07-23 20:05:54 -0400
commit5936fb83e5ac073e2a172965a29009ce77305d45 (patch)
tree45fe6f74b4df627703ac97d6c49df2475651479d
parent30f8f9c9585704d03e299f648e3a1441818cccb0 (diff)
parent6211f59248d8cc37d6b6fd52e65258d1e3b585f1 (diff)
Merge pull request #524 from IvanIFChen/tma1022-tabbar-removed-in-moment-post
[TMA-1022] Remove tab bar in moment post/comment
-rw-r--r--src/screens/moments/CameraScreen.tsx2
-rw-r--r--src/screens/profile/CaptionScreen.tsx18
-rw-r--r--src/screens/profile/MomentCommentsScreen.tsx21
3 files changed, 37 insertions, 4 deletions
diff --git a/src/screens/moments/CameraScreen.tsx b/src/screens/moments/CameraScreen.tsx
index ecf19f3a..27412486 100644
--- a/src/screens/moments/CameraScreen.tsx
+++ b/src/screens/moments/CameraScreen.tsx
@@ -27,7 +27,7 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => {
const {screenType, selectedCategory} = route.params;
const cameraRef = createRef<RNCamera>();
const tabBarHeight = useBottomTabBarHeight();
- const [cameraType, setCameraType] = useState<keyof CameraType>('front');
+ const [cameraType, setCameraType] = useState<keyof CameraType>('back');
const [flashMode, setFlashMode] = useState<keyof FlashMode>('off');
const [mostRecentPhoto, setMostRecentPhoto] = useState<string>('');
const [isRecording, setIsRecording] = useState<boolean>(false);
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 6ba1791c..3ee0bd5b 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -93,6 +93,15 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
}, [route.params.selectedCategory]);
useEffect(() => {
+ // if we're editing, hide tab bar
+ if (moment) {
+ navigation.dangerouslyGetParent()?.setOptions({
+ tabBarVisible: false,
+ });
+ }
+ }, [route.params.moment]);
+
+ useEffect(() => {
let listString = '';
// Append non-truncated usernames together and no more than 21 characters total
// e.g. "@ivan.tagg"
@@ -271,7 +280,14 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
<Button
title="Cancel"
buttonStyle={styles.button}
- onPress={() => navigation.goBack()}
+ onPress={() => {
+ if (moment) {
+ navigation.dangerouslyGetParent()?.setOptions({
+ tabBarVisible: true,
+ });
+ }
+ navigation.goBack();
+ }}
/>
</View>
<CaptionScreenHeader style={styles.header} title={'Moments'} />
diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx
index 7dfe8ae9..490edd53 100644
--- a/src/screens/profile/MomentCommentsScreen.tsx
+++ b/src/screens/profile/MomentCommentsScreen.tsx
@@ -1,5 +1,9 @@
-import {RouteProp, useNavigation} from '@react-navigation/native';
-import React, {useEffect, useState} from 'react';
+import {
+ RouteProp,
+ useFocusEffect,
+ useNavigation,
+} from '@react-navigation/native';
+import React, {useCallback, useEffect, useState} from 'react';
import {StyleSheet, View} from 'react-native';
import {SafeAreaView} from 'react-native-safe-area-context';
import {TabsGradient} from '../../components';
@@ -52,6 +56,19 @@ const MomentCommentsScreen: React.FC<MomentCommentsScreenProps> = ({route}) => {
CommentType | CommentThreadType | undefined
>();
+ useFocusEffect(
+ useCallback(() => {
+ navigation.dangerouslyGetParent()?.setOptions({
+ tabBarVisible: false,
+ });
+ return () => {
+ navigation.dangerouslyGetParent()?.setOptions({
+ tabBarVisible: true,
+ });
+ };
+ }, [navigation]),
+ );
+
useEffect(() => {
navigation.setOptions({
...headerBarOptions('black', `${commentsLength} Comments`),