forked from rescript-react-native/rescript-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonExample.re
More file actions
80 lines (74 loc) · 2 KB
/
ButtonExample.re
File metadata and controls
80 lines (74 loc) · 2 KB
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
open BsReactNative;
open Utils;
let onButtonPress = () => Alert.alert(~title="Button has been pressed!", ());
let exampleType = Multiple;
let displayName = "ButtonExample";
let title = "<Button>";
let description = "Simple React Native button component.";
let examples: array(Example.t) = [|
{
title: "Simple Button",
description:
Some(
"The title and onPress handler are required. It is recommended to set accessibilityLabel to help make your app usable by everyone.",
),
render: () =>
<Button
onPress=onButtonPress
title="Press Me"
accessibilityLabel="See an informative alert"
/>,
},
{
title: "Adjusted color",
description:
Some(
"Adjusts the color in a way that looks standard on each "
++ "platform. On iOS, the color prop controls the color of the text. On "
++ "Android, the color adjusts the background color of the button.",
),
render: () =>
<Button
onPress=onButtonPress
title="Press Purple"
color="#841584"
accessibilityLabel="Learn more about purple"
/>,
},
{
title: "Fit to text layout",
description:
Some(
"This layout strategy lets the title define the width of "
++ "the button",
),
render: () =>
<View
style=Style.(
style([flexDirection(Row), justifyContent(SpaceBetween)])
)>
<Button
onPress=onButtonPress
title="This looks great!"
accessibilityLabel="This sounds great!"
/>
<Button
onPress=onButtonPress
title="Ok!"
color="#841584"
accessibilityLabel="Ok, Great!"
/>
</View>,
},
{
title: "Disabled Button",
description: Some("All interactions for the component are disabled."),
render: () =>
<Button
disabled=true
onPress=onButtonPress
title="I Am Disabled"
accessibilityLabel="See an informative alert"
/>,
},
|];