-
-
Notifications
You must be signed in to change notification settings - Fork 196
/
ScrollView.re
62 lines (56 loc) · 1.45 KB
/
ScrollView.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
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
open Revery;
open Revery.UI;
open Revery.UI.Components;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
let outerBox =
Style.[width(200), height(200), backgroundColor(Colors.black)];
let innerBox =
Style.[
width(450),
height(450),
backgroundColor(Color.rgba(0., 1., 0., 0.5)),
];
module Sample = {
let%component make = () => {
let%hook (bounce, setBounce) = Hooks.state(true);
<View style=containerStyle>
<Text text="Bounce" fontSize=20. style=Style.[marginBottom(10)] />
<Checkbox
onChange={() => setBounce(isBounce => !isBounce)}
checked=bounce
style=Style.[marginBottom(10)]
/>
<ScrollView style=outerBox bounce>
<Image
src={`File("outrun-logo.png")}
/* Exercise the case in #579 */
style=Style.[overflow(`Hidden), width(512), height(256)]
/>
<Image
src={`File("outrun-logo.png")}
style=Style.[width(512), height(256)]
/>
<Image
src={`File("outrun-logo.png")}
style=Style.[width(512), height(256)]
/>
</ScrollView>
<Text
text="To scroll horizontally use Mouse Wheel while holding Shift Key"
fontSize=20.
style=Style.[marginTop(10)]
/>
</View>;
};
};
let render = () => <Sample />;