FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rescript-react-navigation/src/Example.res at main · rescript-react-native/rescript-react-navigation · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
rescript-react-native
/
rescript-react-navigation
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
31
Star
71
Code
Issues
2
Pull requests
4
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
rescript-react-navigation
/
src
/
Example.res
Copy path
More file actions
More file actions
Latest commit
History
History
History
86 lines (79 loc) · 2.26 KB
Breadcrumbs
rescript-react-navigation
/
src
/
Example.res
Copy path
File metadata and controls
86 lines (79 loc) · 2.26 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Uncomment this to compile this example outside of this repo
// in this example it's not necessary (since we are running it in the module repo itself)
// open ReactNavigation;
open
ReactNative
module
HomeScreen
=
{
@
react.component
(:
Core
.
screenProps
)
let
make
=
(~
navigation
as
_
, ~
route
as
_
)
=>
<
Text
> {
"Hello Reasonable Person!"
->
React
.
string
} </
Text
>
}
module
ModalScreen
=
{
@
react.component
(:
Core
.
screenProps
)
let
make
=
(~
navigation
as
_
, ~
route
as
_
)
=>
<
Text
> {
"Hello From Modal"
->
React
.
string
} </
Text
>
}
module
MainStackScreen
=
{
include
Stack
.
Make
()
@
react.component
(:
Core
.
screenProps
)
let
make
=
(~
navigation
as
_
, ~
route
as
_
)
=>
<
Navigator
>
<
Screen
name
=
"Home"
component
=
HomeScreen
.
make
options
=
{
props
=>
{
headerRight
:
_
=>
<
Button
onPress
=
{
_
=>
props
.
navigation
->
Core
.
Navigation
.
navigate
(
"MyModal"
)}
title
=
"Info"
color
=
"#f00"
/>,
title
:
switch
props
.
route
.
params
{
|
Some
(
params
)
=>
(
params
->
Core
.
Params
.
unsafeGetValue
)[
"name"
]
|
None
=>
"Reason"
},
}}
/>
</
Navigator
>
}
module
RootStackScreen
=
{
include
Stack
.
Make
()
let
linking
=
{
open
Native
.
Linking
{
prefixes
: [
"https://www.example.com"
],
config
: {
initialRouteName
:
"app"
,
screens
: [
(
"app"
,
{
screens
: [
(
"tab1"
,
{
screens
: [(
"home"
, {
path
:
""
})]
->
Js
.
Dict
.
fromArray
,
},
),
(
"tab2"
,
{
screens
: [(
"config"
, {
path
:
"/config"
})]
->
Js
.
Dict
.
fromArray
,
},
),
]
->
Js
.
Dict
.
fromArray
,
},
),
]
->
Js
.
Dict
.
fromArray
,
},
}
}
@
react.component
let
make
=
()
=>
<
Native
.
NavigationContainer
linking
>
<
Navigator
screenOptions
=
{
_
=>
{
presentation
:
#modal
}}>
<
Screen
name
=
"Main"
component
=
MainStackScreen
.
make
/>
<
Screen
name
=
"MyModal"
>
{({
navigation
,
route
})
=>
<
ModalScreen
navigation
route
/>}
</
Screen
>
</
Navigator
>
</
Native
.
NavigationContainer
>
}
Back
|
FazBrowse Home
|
New Git URL