Skip to content

Commit b7a5b83

Browse files
committed
react-native-template-reason: update hello world with some comments
1 parent 3109ff1 commit b7a5b83

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

  • react-native-template-reason/src

‎react-native-template-reason/src/App.re‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@
66
*/
77
open ReactNative;
88

9-
let instructions =
10-
switch (Platform.os) {
11-
| os when os == Platform.ios =>
12-
"Press Cmd+R to reload,\n" ++ "Cmd+D or shake for dev menu"
13-
| os when os == Platform.android =>
14-
"Double tap R on your keyboard to reload,\n"
15-
++ "Shake or press menu button for dev menu"
16-
| os when os == Platform.web => "Press Cmd+R to reload."
17-
| _ => ""
18-
};
19-
9+
/*
10+
Here is StyleSheet that is using Style module to define styles for your components
11+
The main different with JavaScript components you may encounter in React Native
12+
is the fact that they **must** be defined before being referenced
13+
(so before actual component definitions)
14+
More at https://reasonml-community.github.io/reason-react-native/en/docs/apis/Style/
15+
*/
2016
let styles =
2117
Style.(
2218
StyleSheet.create({
@@ -44,5 +40,20 @@ let app = () =>
4440
<Text style=styles##instructions>
4541
"To get started, edit src/App.re"->React.string
4642
</Text>
47-
<Text style=styles##instructions> instructions->React.string </Text>
43+
<Text style=styles##instructions>
44+
{switch (Platform.os) {
45+
/*
46+
Instructions depends on the platform this code will run on
47+
More at https://reasonml-community.github.io/reason-react-native/en/docs/apis/Platform/
48+
*/
49+
| os when os == Platform.ios =>
50+
"Press Cmd+R to reload,\n" ++ "Cmd+D or shake for dev menu"
51+
| os when os == Platform.android =>
52+
"Double tap R on your keyboard to reload,\n"
53+
++ "Shake or press menu button for dev menu"
54+
| os when os == Platform.web => "Press Cmd+R to reload."
55+
| _ => ""
56+
}}
57+
->React.string
58+
</Text>
4859
</View>;

0 commit comments

Comments
 (0)