From 8b3bb9164453498b78e497e4e8f3a5252b4159ea Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 8 Jul 2021 17:42:17 -0400 Subject: Hook up navigation to custom category creation --- src/screens/profile/CategorySelection.tsx | 1 + src/screens/profile/ChoosingCategoryScreen.tsx | 4 ++-- src/screens/profile/CreateCustomCategory.tsx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/profile/CategorySelection.tsx b/src/screens/profile/CategorySelection.tsx index ea443fce..9b8672ea 100644 --- a/src/screens/profile/CategorySelection.tsx +++ b/src/screens/profile/CategorySelection.tsx @@ -170,6 +170,7 @@ const CategorySelection: React.FC = ({ onPress={() => { navigation.push('CreateCustomCategory', { existingCategories: momentCategories.concat(selectedCategories), + fromScreen: 'CategorySelection', }); }}> diff --git a/src/screens/profile/ChoosingCategoryScreen.tsx b/src/screens/profile/ChoosingCategoryScreen.tsx index daf7642d..24db015e 100644 --- a/src/screens/profile/ChoosingCategoryScreen.tsx +++ b/src/screens/profile/ChoosingCategoryScreen.tsx @@ -43,7 +43,7 @@ const ChoosingCategoryScreen: React.FC = ({ const tabBarHeight = useBottomTabBarHeight(); const insetTop = useSafeAreaInsets().top; - const MomentItem: FC<{ + const ListItem: FC<{ title: string; onPress: () => void; }> = ({title, onPress}) => { @@ -80,7 +80,7 @@ const ChoosingCategoryScreen: React.FC = ({ style={{height: SCREEN_HEIGHT * 0.9}} contentContainerStyle={{paddingBottom: tabBarHeight}}> {momentCategories.map((title) => ( - diff --git a/src/screens/profile/CreateCustomCategory.tsx b/src/screens/profile/CreateCustomCategory.tsx index c4b17b1e..91083c7c 100644 --- a/src/screens/profile/CreateCustomCategory.tsx +++ b/src/screens/profile/CreateCustomCategory.tsx @@ -37,14 +37,14 @@ const CreateCustomCategory: React.FC = ({ /** * Same component to be used for category selection while onboarding and while on profile */ - const {existingCategories} = route.params; + const {existingCategories, fromScreen} = route.params; const [newCategory, setNewCategory] = useState(''); const handleButtonPress = () => { if (existingCategories.includes(newCategory)) { Alert.alert('Looks like you already have that one created!'); } else { - navigation.navigate('CategorySelection', { + navigation.navigate(fromScreen, { newCustomCategory: newCategory, }); } -- cgit v1.2.3-70-g09d2