@@ -2,7 +2,7 @@ open ReactNative;
22let styles =
33 Style . (
44 StyleSheet . create({
5- "buttons" : style(~flexDirection= ` row , ~padding= 8 .-> dp, () ),
5+ "buttons" : style(~flexDirection= ` column , ~padding= 8 .-> dp, () ),
66 "button" : style(~margin= 8 .-> dp, () ),
77 })
88 );
@@ -31,33 +31,39 @@ module Counter =
3131 type value = counter ;
3232 let useHook = useCounter;
3333 });
34+
3435module CounterDisplay = {
3536 [@ react . component ]
3637 let make = () => {
3738 let counter = Counter . useContainer() ;
38- <View
39- style= Style . (
39+ // <View style=styles##buttons>
40+ < View style= Style . (
4041 style(~flex= 1 ., ~alignItems= ` center , ~justifyContent= ` center , () )
4142 )>
42- <View style= Style . (style(~width= 100 .-> dp, ~height= 50 .-> dp, () ))>
43- <Button title= "-" onPress= {_ => counter. decrement() } />
44- </View >
43+ <Paper . IconButton
44+ mode= ` contained
45+ onPress= {_ => counter. decrement() }
46+ style= styles##button
47+ icon= "remove"
48+ />
4549 <Text style= Style . (style(~fontSize= 50 ., () ))>
4650 {React . string(string_of_int(counter. count))}
4751 </Text >
48- <View style= Style . (style(~width= 100 .-> dp, ~height= 50 .-> dp, () ))>
49- <Button title= "+" onPress= {_ => counter. increment() } />
50- </View >
51- <PaperButton
52+ <Paper . IconButton
5253 mode= ` contained
53- onPress= {_ => counter. reset () }
54+ onPress= {_ => counter. increment () }
5455 style= styles##button
55- >"Reset" -> React . string</PaperButton >
56+ icon= "add"
57+ />
58+ <Paper . Button
59+ mode= ` contained onPress= {_ => counter. reset() } style= styles##button>
60+ "Reset" -> React . string
61+ </Paper . Button >
5662 </View >;
5763 };
5864};
5965
60- module HomeScreen = {
66+ module App = {
6167 [@ react . component ]
6268 let make = () =>
6369 <Counter . Provider >
@@ -67,4 +73,4 @@ module HomeScreen = {
6773};
6874
6975[@ react . component ]
70- let make = () => <HomeScreen />;
76+ let make = () => <App />;
0 commit comments