Last active
March 3, 2018 19:01
-
-
Save peterpme/125bea98fb9be242ca19c117882bbbe8 to your computer and use it in GitHub Desktop.
Reason Label
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open BsReactNative; | |
let component = ReasonReact.statelessComponent("Label"); | |
let styles = | |
StyleSheet.create( | |
Style.( | |
{ | |
"container": | |
style([ | |
borderRadius(4.), | |
paddingHorizontal(Pt(10.)), | |
paddingVertical(Pt(2.)), | |
backgroundColor("rgba(125, 147, 168, 0.5)") | |
]), | |
"label": | |
style([color("white"), textAlign(Center), fontSize(Float(11.))]) | |
} | |
) | |
); | |
let make = (~label, _children) => { | |
...component, | |
render: _self => | |
<View style=styles##container> | |
<Text style=styles##label> | |
(ReasonReact.stringToElement(label)) | |
</Text> | |
</View> | |
}; | |
let default = | |
ReasonReact.wrapReasonForJs(~component, jsProps => | |
make(~label=jsProps##label, [||]) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment