-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathDefaultButton.re
35 lines (28 loc) · 917 Bytes
/
DefaultButton.re
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
open Revery;
open Revery.UI;
open Revery.UI.Components;
module DefaultButtonWithCounter = {
let%component make = () => {
let%hook (count, setCount) = Hooks.state(0);
let increment = () => setCount(_ => count + 1);
let containerStyle =
Style.[justifyContent(`Center), alignItems(`Center)];
let countContainer =
Style.[
width(300),
height(300),
alignItems(`Center),
justifyContent(`Center),
];
let countStyle = Style.[margin(24), color(Colors.black)];
let countStr = string_of_int(count);
<View style=containerStyle>
<View style=countContainer>
<Text fontSize=50. style=countStyle text=countStr />
</View>
<Button title="click me!" onClick=increment />
<Button disabled=true title="(disabled)" onClick=increment />
</View>;
};
};
let render = () => <View> <DefaultButtonWithCounter /> </View>;