Skip to content

Commit a60d831

Browse files
committed
Update example to avoid deprecation warnings :)
1 parent c2a8937 commit a60d831

1 file changed

Lines changed: 107 additions & 117 deletions

File tree

‎example/src/pages/ViewExample.re‎

Lines changed: 107 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -38,39 +38,35 @@ module ViewBorderStyleExample = {
3838
onPress={_event => send(UpdateBorderState(!state.showBorder))}>
3939
<View>
4040
<View
41-
style={
42-
style([
43-
borderWidth(1.),
44-
borderStyle(
45-
if (state.showBorder) {
46-
Dashed;
47-
} else {
48-
Solid;
49-
},
50-
),
51-
padding(Pt(5.)),
52-
])
53-
}>
41+
style={style([
42+
borderWidth(1.),
43+
borderStyle(
44+
if (state.showBorder) {
45+
Dashed;
46+
} else {
47+
Solid;
48+
},
49+
),
50+
padding(Pt(5.)),
51+
])}>
5452
<Text style={style([fontSize(Float(11.))])}>
5553
{ReasonReact.string("Dashed border style")}
5654
</Text>
5755
</View>
5856
<View
59-
style={
60-
style([
61-
marginTop(Pt(5.)),
62-
borderWidth(1.),
63-
borderRadius(5.),
64-
borderStyle(
65-
if (state.showBorder) {
66-
Dotted;
67-
} else {
68-
Solid;
69-
},
70-
),
71-
padding(Pt(5.)),
72-
])
73-
}>
57+
style={style([
58+
marginTop(Pt(5.)),
59+
borderWidth(1.),
60+
borderRadius(5.),
61+
borderStyle(
62+
if (state.showBorder) {
63+
Dotted;
64+
} else {
65+
Solid;
66+
},
67+
),
68+
padding(Pt(5.)),
69+
])}>
7470
<Text style={style([fontSize(Float(11.))])}>
7571
{ReasonReact.string("Dotted border style")}
7672
</Text>
@@ -111,53 +107,53 @@ module ZIndexExample = {
111107
</Text>
112108
<View
113109
style={
114-
concat([
115-
styles##zIndex,
116-
style([
117-
marginTop(Pt(0.)),
118-
backgroundColor(String("#E57373")),
119-
zIndex(Array.unsafe_get(indices, 0)),
120-
]),
121-
])
110+
styles##zIndex
111+
->merge(
112+
style([
113+
marginTop(Pt(0.)),
114+
backgroundColor(String("#E57373")),
115+
zIndex(Array.unsafe_get(indices, 0)),
116+
]),
117+
)
122118
}>
123119
<Text> {ReasonReact.string(zIndexStr(0))} </Text>
124120
</View>
125121
<View
126122
style={
127-
concat([
128-
styles##zIndex,
129-
style([
130-
marginLeft(Pt(50.)),
131-
backgroundColor(String("#FFF176")),
132-
zIndex(Array.unsafe_get(indices, 1)),
133-
]),
134-
])
123+
styles##zIndex
124+
->merge(
125+
style([
126+
marginLeft(Pt(50.)),
127+
backgroundColor(String("#FFF176")),
128+
zIndex(Array.unsafe_get(indices, 1)),
129+
]),
130+
)
135131
}>
136132
<Text> {ReasonReact.string(zIndexStr(1))} </Text>
137133
</View>
138134
<View
139135
style={
140-
concat([
141-
styles##zIndex,
142-
style([
143-
marginLeft(Pt(100.)),
144-
backgroundColor(String("#81C784")),
145-
zIndex(Array.unsafe_get(indices, 2)),
146-
]),
147-
])
136+
styles##zIndex
137+
->merge(
138+
style([
139+
marginLeft(Pt(100.)),
140+
backgroundColor(String("#81C784")),
141+
zIndex(Array.unsafe_get(indices, 2)),
142+
]),
143+
)
148144
}>
149145
<Text> {ReasonReact.string(zIndexStr(2))} </Text>
150146
</View>
151147
<View
152148
style={
153-
concat([
154-
styles##zIndex,
155-
style([
156-
marginLeft(Pt(150.)),
157-
backgroundColor(String("#64B5F6")),
158-
zIndex(Array.unsafe_get(indices, 3)),
159-
]),
160-
])
149+
styles##zIndex
150+
->merge(
151+
style([
152+
marginLeft(Pt(150.)),
153+
backgroundColor(String("#64B5F6")),
154+
zIndex(Array.unsafe_get(indices, 3)),
155+
]),
156+
)
161157
}>
162158
<Text> {ReasonReact.string(zIndexStr(3))} </Text>
163159
</View>
@@ -183,9 +179,10 @@ let examples: array(Example.t) =
183179
description: None,
184180
render: () =>
185181
<View
186-
style={
187-
style([backgroundColor(String("#527FE4")), padding(Pt(5.))])
188-
}>
182+
style={style([
183+
backgroundColor(String("#527FE4")),
184+
padding(Pt(5.)),
185+
])}>
189186
<Text style={style([fontSize(Float(11.))])}>
190187
{ReasonReact.string("Blue background")}
191188
</Text>
@@ -196,13 +193,11 @@ let examples: array(Example.t) =
196193
description: None,
197194
render: () =>
198195
<View
199-
style={
200-
style([
201-
borderColor(String("#527FE4")),
202-
borderWidth(5.),
203-
padding(Pt(10.)),
204-
])
205-
}>
196+
style={style([
197+
borderColor(String("#527FE4")),
198+
borderWidth(5.),
199+
padding(Pt(10.)),
200+
])}>
206201
<Text style={style([fontSize(Float(11.))])}>
207202
{ReasonReact.string("5px blue border")}
208203
</Text>
@@ -213,29 +208,30 @@ let examples: array(Example.t) =
213208
description: None,
214209
render: () =>
215210
<View
216-
style={
217-
style([borderColor(String("#bb0000")), borderWidth(1.)])
218-
}>
219-
<View style={concat([styles##box, style([padding(Pt(5.))])])}>
211+
style={style([
212+
borderColor(String("#bb0000")),
213+
borderWidth(1.),
214+
])}>
215+
<View style={styles##box->merge(style([padding(Pt(5.))]))}>
220216
<Text style={style([fontSize(Float(11.))])}>
221217
{ReasonReact.string("5px padding")}
222218
</Text>
223219
</View>
224-
<View style={concat([styles##box, style([margin(Pt(5.))])])}>
220+
<View style={styles##box->merge(style([margin(Pt(5.))]))}>
225221
<Text style={style([fontSize(Float(11.))])}>
226222
{ReasonReact.string("5px margin")}
227223
</Text>
228224
</View>
229225
<View
230226
style={
231-
concat([
232-
styles##box,
233-
style([
234-
margin(Pt(5.)),
235-
padding(Pt(5.)),
236-
alignSelf(FlexStart),
237-
]),
238-
])
227+
styles##box
228+
->merge(
229+
style([
230+
margin(Pt(5.)),
231+
padding(Pt(5.)),
232+
alignSelf(FlexStart),
233+
]),
234+
)
239235
}>
240236
<Text style={style([fontSize(Float(11.))])}>
241237
{ReasonReact.string("5px margin and padding,")}
@@ -251,15 +247,15 @@ let examples: array(Example.t) =
251247
description: None,
252248
render: () =>
253249
<View
254-
style={
255-
style([borderWidth(1.), borderRadius(5.), padding(Pt(5.))])
256-
}>
250+
style={style([
251+
borderWidth(1.),
252+
borderRadius(5.),
253+
padding(Pt(5.)),
254+
])}>
257255
<Text style={style([fontSize(Float(11.))])}>
258-
{
259-
ReasonReact.string(
260-
"Too much use of `borderRadius` (especially large radii) on\nanything which is scrolling may result in dropped frames.\nUse sparingly.",
261-
)
262-
}
256+
{ReasonReact.string(
257+
"Too much use of `borderRadius` (especially large radii) on\nanything which is scrolling may result in dropped frames.\nUse sparingly.",
258+
)}
263259
</Text>
264260
</View>,
265261
},
@@ -273,14 +269,12 @@ let examples: array(Example.t) =
273269
description: None,
274270
render: () =>
275271
<View
276-
style={
277-
style([
278-
borderRadius(10.),
279-
borderWidth(1.),
280-
width(Pt(20.)),
281-
height(Pt(20.)),
282-
])
283-
}
272+
style={style([
273+
borderRadius(10.),
274+
borderWidth(1.),
275+
width(Pt(20.)),
276+
height(Pt(20.)),
277+
])}
284278
/>,
285279
},
286280
{
@@ -289,29 +283,25 @@ let examples: array(Example.t) =
289283
render: () =>
290284
<View style={style([flexDirection(Row)])}>
291285
<View
292-
style={
293-
style([
294-
width(Pt(95.)),
295-
height(Pt(10.)),
296-
marginRight(Pt(10.)),
297-
marginBottom(Pt(5.)),
298-
overflow(Hidden),
299-
borderWidth(StyleSheet.hairlineWidth),
300-
])
301-
}>
286+
style={style([
287+
width(Pt(95.)),
288+
height(Pt(10.)),
289+
marginRight(Pt(10.)),
290+
marginBottom(Pt(5.)),
291+
overflow(Hidden),
292+
borderWidth(StyleSheet.hairlineWidth),
293+
])}>
302294
<View style={style([width(Pt(200.)), height(Pt(20.))])}>
303295
<Text> {ReasonReact.string("Overflow hidden")} </Text>
304296
</View>
305297
</View>
306298
<View
307-
style={
308-
style([
309-
width(Pt(95.)),
310-
height(Pt(10.)),
311-
marginBottom(Pt(5.)),
312-
borderWidth(StyleSheet.hairlineWidth),
313-
])
314-
}>
299+
style={style([
300+
width(Pt(95.)),
301+
height(Pt(10.)),
302+
marginBottom(Pt(5.)),
303+
borderWidth(StyleSheet.hairlineWidth),
304+
])}>
315305
<View style={style([width(Pt(200.)), height(Pt(20.))])}>
316306
<Text> {ReasonReact.string("Overflow visible")} </Text>
317307
</View>

0 commit comments

Comments
 (0)