GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rescript-react-navigation/src/Example.res at main · rescript-react-native/rescript-react-navigation

Expand file tree

/

Example.res

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
86 lines (79 loc) · 2.26 KB
/

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>
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.