From dff83dc855e9500bc228a1491601e660527afa10 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 9 Jul 2021 18:40:30 -0400 Subject: Allow preselect category from profile screen --- src/components/comments/ZoomInCropper.tsx | 4 +++- src/components/moments/Moment.tsx | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/components') diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx index 8b87d137..e624c81c 100644 --- a/src/components/comments/ZoomInCropper.tsx +++ b/src/components/comments/ZoomInCropper.tsx @@ -24,7 +24,7 @@ export const ZoomInCropper: React.FC = ({ route, navigation, }) => { - const {screenType, media} = route.params; + const {screenType, media, selectedCategory} = route.params; const [aspectRatio, setAspectRatio] = useState(1); // Stores the coordinates of the cropped image @@ -67,6 +67,7 @@ export const ZoomInCropper: React.FC = ({ uri: croppedURL, isVideo: false, }, + selectedCategory, }); }) .catch((err) => console.log('err: ', err)); @@ -79,6 +80,7 @@ export const ZoomInCropper: React.FC = ({ navigation.navigate('CaptionScreen', { screenType, media, + selectedCategory, }); } }; diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 12c1fda4..087b343f 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -1,3 +1,4 @@ +import {useNavigation} from '@react-navigation/native'; import React from 'react'; import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native'; import {Text} from 'react-native-animatable'; @@ -8,7 +9,6 @@ import DownIcon from '../../assets/icons/down_icon.svg'; import BigPlusIcon from '../../assets/icons/plus-icon-white.svg'; import UpIcon from '../../assets/icons/up_icon.svg'; import {TAGG_LIGHT_BLUE} from '../../constants'; -import * as RootNavigation from '../../RootNavigation'; import {MomentType, ScreenType} from '../../types'; import {normalize, SCREEN_WIDTH} from '../../utils'; import MomentTile from './MomentTile'; @@ -38,6 +38,7 @@ const Moment: React.FC = ({ move, externalStyles, }) => { + const navigation = useNavigation(); return ( @@ -97,7 +98,13 @@ const Moment: React.FC = ({ /> ))} {(images === undefined || images.length === 0) && !userXId && ( - RootNavigation.navigate('Upload')}> + + navigation.navigate('CameraScreen', { + screenType: ScreenType.Profile, + selectedCategory: title, + }) + }> -- cgit v1.2.3-70-g09d2