forked from rescript-react-native/rescript-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRNTesterBlock.re
More file actions
60 lines (57 loc) · 1.68 KB
/
RNTesterBlock.re
File metadata and controls
60 lines (57 loc) · 1.68 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
open BsReactNative;
let styles =
StyleSheet.create(
Style.{
"container":
style([
borderRadius(3.),
borderWidth(1.),
borderColor(String("#d6d7da")),
backgroundColor(String("#ffffff")),
margin(Pt(10.)),
marginVertical(Pt(5.)),
overflow(Hidden),
]),
"titleContainer":
style([
borderBottomWidth(1.),
borderTopLeftRadius(3.),
borderTopRightRadius(3.),
borderBottomColor(String("#d6d7da")),
backgroundColor(String("#f6f7f8")),
paddingHorizontal(Pt(10.)),
paddingVertical(Pt(5.)),
]),
"titleText": style([fontSize(Float(14.)), fontWeight(`_500)]),
"descriptionText": style([fontSize(Float(14.))]),
"disclosure":
style([
position(Absolute),
top(Pt(0.)),
right(Pt(0.)),
padding(Pt(10.)),
]),
"disclosureIcon": style([width(Pt(12.)), height(Pt(8.))]),
"children": style([margin(Pt(10.))]),
},
);
let comp = ReasonReact.statelessComponent("RNTesterBlock");
let make = (~description, ~title, children) => {
...comp,
render: _self =>
<View style=styles##container>
<View style=styles##titleContainer>
<Text style=styles##titleText> {ReasonReact.string(title)} </Text>
{
switch (description) {
| Some(description) =>
<Text style=styles##descriptionText>
{ReasonReact.string(description)}
</Text>
| None => ReasonReact.null
}
}
</View>
{View.make(~style=styles##children, children) |> ReasonReact.element}
</View>,
};