Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL KI Ganjil 2021 2022
Clicks - Ecosystem Business
clicks-frontend
Commits
91e7dd9a
Commit
91e7dd9a
authored
Oct 10, 2021
by
Abraham Rudolf Brahmana
Committed by
angelin depthios
Oct 10, 2021
Browse files
feat: Pass function as params in ecosystem navigation
parent
66bb9b6f
Changes
3
Show whitespace changes
Inline
Side-by-side
src/screens/ecosystem/BusinessEcosystemScreen.tsx
View file @
91e7dd9a
...
@@ -6,6 +6,7 @@ import SmallButton from "../../components/button/SmallButton";
...
@@ -6,6 +6,7 @@ import SmallButton from "../../components/button/SmallButton";
import
Spacer
from
"
../../components/Spacer/Spacer
"
;
import
Spacer
from
"
../../components/Spacer/Spacer
"
;
import
{
Text
,
View
}
from
"
../../components/Themed
"
;
import
{
Text
,
View
}
from
"
../../components/Themed
"
;
import
Colors
from
"
../../constants/Colors
"
;
import
Colors
from
"
../../constants/Colors
"
;
import
{
IEcosystem
}
from
"
../../types/firestore/ecosystems
"
;
const
BusinessEcosystemScreen
=
()
=>
{
const
BusinessEcosystemScreen
=
()
=>
{
const
nav
=
useNavigation
();
const
nav
=
useNavigation
();
...
@@ -31,7 +32,9 @@ const BusinessEcosystemScreen = () => {
...
@@ -31,7 +32,9 @@ const BusinessEcosystemScreen = () => {
screen
:
"
Recommended
"
,
screen
:
"
Recommended
"
,
params
:
{
params
:
{
headerTitle
:
"
Ekosistem Saya
"
,
headerTitle
:
"
Ekosistem Saya
"
,
toFetch
:
"
MyEcosystem
"
,
toFetch
:
()
=>
{
return
new
Promise
<
IEcosystem
[]
>
(()
=>
{});
},
},
},
});
});
}
}
}
}
...
@@ -69,7 +72,9 @@ const BusinessEcosystemScreen = () => {
...
@@ -69,7 +72,9 @@ const BusinessEcosystemScreen = () => {
screen
:
"
Recommended
"
,
screen
:
"
Recommended
"
,
params
:
{
params
:
{
headerTitle
:
"
Paling Populer
"
,
headerTitle
:
"
Paling Populer
"
,
toFetch
:
"
Popular
"
,
toFetch
:
()
=>
{
return
new
Promise
<
IEcosystem
[]
>
(()
=>
{});
},
},
},
});
});
}
}
}
}
...
@@ -85,7 +90,9 @@ const BusinessEcosystemScreen = () => {
...
@@ -85,7 +90,9 @@ const BusinessEcosystemScreen = () => {
screen
:
"
Recommended
"
,
screen
:
"
Recommended
"
,
params
:
{
params
:
{
headerTitle
:
"
Terbaru Minggu Ini
"
,
headerTitle
:
"
Terbaru Minggu Ini
"
,
toFetch
:
"
Latest
"
,
toFetch
:
()
=>
{
return
new
Promise
<
IEcosystem
[]
>
(()
=>
{});
},
},
},
});
});
}
}
}
}
...
...
src/screens/ecosystem/RecommendedEcosystemScreen.tsx
View file @
91e7dd9a
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
=
async
({
route
,
route
,
}:
EcosystemStackScreenProps
<
"
Recommended
"
>
)
=>
{
}:
EcosystemStackScreenProps
<
"
Recommended
"
>
)
=>
{
const
{
toFetch
}
=
route
.
params
;
const
{
toFetch
}
=
route
.
params
;
await
toFetch
();
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
>
);
);
...
...
src/types/navigation/EcosystemStack.ts
View file @
91e7dd9a
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* https://reactnavigation.org/docs/typescript/
* https://reactnavigation.org/docs/typescript/
*/
*/
import
{
NativeStackScreenProps
}
from
"
@react-navigation/native-stack
"
;
import
{
NativeStackScreenProps
}
from
"
@react-navigation/native-stack
"
;
import
{
IEcosystem
}
from
"
../firestore/ecosystems
"
;
export
type
EcosystemStackParamList
=
{
export
type
EcosystemStackParamList
=
{
BusinessEcosystem
:
undefined
;
BusinessEcosystem
:
undefined
;
...
@@ -12,7 +13,7 @@ export type EcosystemStackParamList = {
...
@@ -12,7 +13,7 @@ export type EcosystemStackParamList = {
EcosystemMap
:
undefined
;
EcosystemMap
:
undefined
;
BusinessList
:
{
headerTitle
:
string
};
BusinessList
:
{
headerTitle
:
string
};
EcosystemDetails
:
{
headerTitle
:
string
};
EcosystemDetails
:
{
headerTitle
:
string
};
Recommended
:
{
headerTitle
:
string
;
toFetch
:
string
};
Recommended
:
{
headerTitle
:
string
;
toFetch
:
()
=>
Promise
<
IEcosystem
[]
>
};
};
};
export
type
EcosystemStackScreenProps
<
export
type
EcosystemStackScreenProps
<
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment