From 560f2c5ce20a8a58a3f1d7d47bbb099307522e7c Mon Sep 17 00:00:00 2001 From: Abraham Rudolf Brahmana Date: Thu, 16 Sep 2021 18:05:15 +0700 Subject: [PATCH] Add profile navigation and create boilerplate profile screen --- src/navigation/BottomTabNavigator.tsx | 25 +++++++++++ src/navigation/ProfileStackNavigator.tsx | 40 +++++++++++++++++ src/navigation/RootNavigator.tsx | 1 + src/screens/profile/AccountSettingsScreen.tsx | 43 +++++++++++++++++++ src/screens/profile/ChangePasswordScreen.tsx | 31 +++++++++++++ src/screens/profile/ProfileScreen.tsx | 43 +++++++++++++++++++ src/types/navigation/ProfileStack.ts | 14 ++++++ src/types/navigation/RootStack.ts | 1 + src/types/navigation/RootTab.ts | 2 +- src/types/navigation/index.tsx | 1 + 10 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 src/navigation/ProfileStackNavigator.tsx create mode 100644 src/screens/profile/AccountSettingsScreen.tsx create mode 100644 src/screens/profile/ChangePasswordScreen.tsx create mode 100644 src/screens/profile/ProfileScreen.tsx create mode 100644 src/types/navigation/ProfileStack.ts diff --git a/src/navigation/BottomTabNavigator.tsx b/src/navigation/BottomTabNavigator.tsx index 508d82f..f4d60b1 100644 --- a/src/navigation/BottomTabNavigator.tsx +++ b/src/navigation/BottomTabNavigator.tsx @@ -5,6 +5,7 @@ import TabOneScreen from "../screens/TabOneScreen"; import { FontAwesome } from "@expo/vector-icons"; import { Pressable } from "react-native"; import Colors from "../constants/Colors"; +import ProfileStackNavigator from "./ProfileStackNavigator"; /** * A bottom tab navigator displays tab buttons on the bottom of the display to switch screens. @@ -43,6 +44,30 @@ const BottomTabNavigator = () => { ), })} /> + ) => ({ + title: "Profile", + headerShown: false, + tabBarIcon: ({ color }) => , + headerRight: () => ( + null} + style={({ pressed }) => ({ + opacity: pressed ? 0.5 : 1, + })} + > + + + ), + })} + /> ); }; diff --git a/src/navigation/ProfileStackNavigator.tsx b/src/navigation/ProfileStackNavigator.tsx new file mode 100644 index 0000000..e4ea33d --- /dev/null +++ b/src/navigation/ProfileStackNavigator.tsx @@ -0,0 +1,40 @@ +import { createNativeStackNavigator } from "@react-navigation/native-stack"; +import React from "react"; +import { StyleSheet } from "react-native"; +import AccountSettingsScreen from "../screens/profile/AccountSettingsScreen"; +import ChangePasswordScreen from "../screens/profile/ChangePasswordScreen"; +import ProfileScreen from "../screens/profile/ProfileScreen"; +import { ProfileStackParamList } from "../types/navigation/ProfileStack"; + +const ProfileStack = createNativeStackNavigator(); + +const AuthStackNavigator = () => { + return ( + + + + + + + ); +}; + +// const styles = StyleSheet.create({ +// header: { +// shadow +// } +// }) + +export default AuthStackNavigator; diff --git a/src/navigation/RootNavigator.tsx b/src/navigation/RootNavigator.tsx index 97ed412..221ec51 100644 --- a/src/navigation/RootNavigator.tsx +++ b/src/navigation/RootNavigator.tsx @@ -3,6 +3,7 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack"; import BottomTabNavigator from "./BottomTabNavigator"; import { RootStackParamList } from "../types/navigation"; import AuthStackNavigator from "./AuthStackNavigator"; +import ProfileStackNavigator from "./ProfileStackNavigator"; /** * A root stack navigator is often used for displaying modals on top of all other content. diff --git a/src/screens/profile/AccountSettingsScreen.tsx b/src/screens/profile/AccountSettingsScreen.tsx new file mode 100644 index 0000000..b2bf01d --- /dev/null +++ b/src/screens/profile/AccountSettingsScreen.tsx @@ -0,0 +1,43 @@ +import { useNavigation } from "@react-navigation/core"; +import * as React from "react"; +import { Button, StyleSheet } from "react-native"; +import { TouchableOpacity } from "react-native-gesture-handler"; + +import { Text, View } from "../../components/Themed"; +import Colors from "../../constants/Colors"; +import { RootTabScreenProps } from "../../types/navigation"; + +export default function AccountSettingsScreen({ + navigation, +}: RootTabScreenProps<"Profile">) { + const nav = useNavigation(); + return ( + + {/* nav.navigate("ChangePassword")}> + Ganti Password + */} +