aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-08 17:42:17 -0400
committerIvan Chen <ivan@tagg.id>2021-07-09 15:56:47 -0400
commit8b3bb9164453498b78e497e4e8f3a5252b4159ea (patch)
tree443bdfe51e24a9b460eed4367720ff33277e3f2f /src
parent2c2921af0fc075482aa1a7d2064d24c4999497ca (diff)
Hook up navigation to custom category creation
Diffstat (limited to 'src')
-rw-r--r--src/components/moments/Moment.tsx2
-rw-r--r--src/routes/main/MainStackNavigator.tsx5
-rw-r--r--src/screens/profile/CategorySelection.tsx1
-rw-r--r--src/screens/profile/ChoosingCategoryScreen.tsx4
-rw-r--r--src/screens/profile/CreateCustomCategory.tsx4
5 files changed, 9 insertions, 7 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx
index a1621f2e..ca736b92 100644
--- a/src/components/moments/Moment.tsx
+++ b/src/components/moments/Moment.tsx
@@ -39,8 +39,6 @@ const Moment: React.FC<MomentProps> = ({
move,
externalStyles,
}) => {
- const navigation = useNavigation();
-
return (
<View style={[styles.container, externalStyles?.container]}>
<View style={[styles.header, externalStyles?.header]}>
diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx
index e840eb38..05f5138f 100644
--- a/src/routes/main/MainStackNavigator.tsx
+++ b/src/routes/main/MainStackNavigator.tsx
@@ -49,7 +49,9 @@ export type MainStackParams = {
selectedTags?: MomentTagType[];
moment?: MomentType;
};
- ChoosingCategoryScreen: {};
+ ChoosingCategoryScreen: {
+ newCustomCategory: string;
+ };
TagFriendsScreen: {
media: {
uri: string;
@@ -88,6 +90,7 @@ export type MainStackParams = {
};
CreateCustomCategory: {
existingCategories: string[];
+ fromScreen: 'ChoosingCategoryScreen' | 'CategorySelection';
};
Notifications: {
screenType: ScreenType;
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<CategorySelectionProps> = ({
onPress={() => {
navigation.push('CreateCustomCategory', {
existingCategories: momentCategories.concat(selectedCategories),
+ fromScreen: 'CategorySelection',
});
}}>
<PlusIcon width={30} height={30} color="white" />
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<ChoosingCategoryScreenProps> = ({
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<ChoosingCategoryScreenProps> = ({
style={{height: SCREEN_HEIGHT * 0.9}}
contentContainerStyle={{paddingBottom: tabBarHeight}}>
{momentCategories.map((title) => (
- <MomentItem
+ <ListItem
key={title}
title={title}
onPress={() =>
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<CreateCustomCategoryProps> = ({
/**
* 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,
});
}