Fakultas Ilmu Komputer UI

Commit 64b6028f authored by Ahmad Izzudin Alifyandra's avatar Ahmad Izzudin Alifyandra
Browse files

Merge branch 'navigation-ecosystem' into 'PBI-13-Create_Ecosystem_Page'

Fix: Navigation ecosystem

See merge request !88
parents 5d70c22e dae99f25
Pipeline #86226 passed with stage
in 17 minutes and 59 seconds
import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"; import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux";
import type { RootState, AppDispatch } from "../redux/store"; import type { RootState, AppDispatch } from "../redux/store";
import { IUser } from "../types/firestore/User";
// Use throughout your app instead of plain `useDispatch` and `useSelector` // Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch = () => useDispatch<AppDispatch>(); export const useAppDispatch = () => useDispatch<AppDispatch>();
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector; export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
export const useUser = () => useAppSelector((state) => state.user); export const useUser = (): IUser => useAppSelector((state) => state.user);
...@@ -4,11 +4,11 @@ import BusinessEcosystemScreen from "../screens/ecosystem/BusinessEcosystemScree ...@@ -4,11 +4,11 @@ import BusinessEcosystemScreen from "../screens/ecosystem/BusinessEcosystemScree
import { EcosystemStackParamList } from "../types/navigation/EcosystemStack"; import { EcosystemStackParamList } from "../types/navigation/EcosystemStack";
import { import {
BusinessCategoryScreen, BusinessCategoryScreen,
UserListScreen,
EcosystemDetailScreen, EcosystemDetailScreen,
EcosystemListScreen, EcosystemListScreen,
EcosystemMapScreen, EcosystemMapScreen,
RecommendedEcosystemScreen, RecommendedEcosystemScreen,
UserListScreen,
} from "../screens/ecosystem"; } from "../screens/ecosystem";
const EcosystemStack = createNativeStackNavigator<EcosystemStackParamList>(); const EcosystemStack = createNativeStackNavigator<EcosystemStackParamList>();
......
...@@ -33,7 +33,13 @@ const BusinessEcosystemScreen = () => { ...@@ -33,7 +33,13 @@ const BusinessEcosystemScreen = () => {
<View> <View>
<TouchableOpacity <TouchableOpacity
onPress={() => { onPress={() => {
nav.navigate("Ecosystem", { screen: "MyEcosystem" }); nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Ekosistem Saya",
toFetch: "myEcosystem",
},
});
}} }}
> >
<Text style={styles.link}>Ekosistem Saya</Text> <Text style={styles.link}>Ekosistem Saya</Text>
...@@ -65,7 +71,13 @@ const BusinessEcosystemScreen = () => { ...@@ -65,7 +71,13 @@ const BusinessEcosystemScreen = () => {
<View> <View>
<TouchableOpacity <TouchableOpacity
onPress={() => { onPress={() => {
nav.navigate("Ecosystem", { screen: "Popular" }); nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Paling Populer",
toFetch: "popular",
},
});
}} }}
> >
<Text style={styles.link}>Paling Populer</Text> <Text style={styles.link}>Paling Populer</Text>
...@@ -75,7 +87,13 @@ const BusinessEcosystemScreen = () => { ...@@ -75,7 +87,13 @@ const BusinessEcosystemScreen = () => {
<View> <View>
<TouchableOpacity <TouchableOpacity
onPress={() => { onPress={() => {
nav.navigate("Ecosystem", { screen: "Latest" }); nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Terbaru Minggu Ini",
toFetch: "mostRecent",
},
});
}} }}
> >
<Text style={styles.link}>Terbaru Minggu Ini</Text> <Text style={styles.link}>Terbaru Minggu Ini</Text>
......
import * as React from "react"; import * as React from "react";
import { Alert, StyleSheet } from "react-native"; import { StyleSheet } from "react-native";
import { Text, View } from "../../components/Themed"; import { Text, View } from "../../components/Themed";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import { EcosystemStackScreenProps } from "../../types/navigation"; import { EcosystemStackScreenProps } from "../../types/navigation";
import { LogBox } from "react-native";
const RecommendedEcosystemScreen = ({ const RecommendedEcosystemScreen = ({
route, route,
}: EcosystemStackScreenProps<"Recommended">) => { }: EcosystemStackScreenProps<"Recommended">) => {
const { toFetch } = route.params; const { toFetch } = route.params;
switch (toFetch) {
case "popular":
break;
case "myEcosystem":
break;
case "mostRecent":
break;
case "joined":
break;
default:
break;
}
LogBox.ignoreLogs([
"Non-serializable values were found in the navigation state",
]);
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View> <View>
<Text onPress={() => Alert.alert(toFetch)}> <Text>Layar Rekomendasi Ekosistem</Text>
Layar Rekomendasi Ekosistem
</Text>
</View> </View>
</View> </View>
); );
......
...@@ -7,7 +7,7 @@ const UserListScreen = () => { ...@@ -7,7 +7,7 @@ const UserListScreen = () => {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View> <View>
<Text>Layar List Bisnis</Text> <Text>Layar List User</Text>
</View> </View>
</View> </View>
); );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment