Skip to content

Instantly share code, notes, and snippets.

@peterpme
Last active March 3, 2018 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterpme/125bea98fb9be242ca19c117882bbbe8 to your computer and use it in GitHub Desktop.
Save peterpme/125bea98fb9be242ca19c117882bbbe8 to your computer and use it in GitHub Desktop.
Reason Label
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