Created
October 5, 2018 22:48
-
-
Save phated/860489201b34e78212388bd9aaf1f4de to your computer and use it in GitHub Desktop.
Experimenting with a Reason API for Emotion
This file contains hidden or 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; | |
[@bs.deriving abstract] | |
type style = { | |
[@bs.optional] | |
color: string, | |
[@bs.optional] | |
fontSize: float, | |
[@bs.optional] | |
margin: float, | |
[@bs.optional] | |
fontWeight: string, | |
[@bs.optional] | |
flex: float, | |
}; | |
module type TextComponent = {include Text.TextComponent;}; | |
module type Styled = {let style: style;}; | |
module Text = (Styled: Styled) : TextComponent => { | |
[@bs.module "@emotion/native"] [@bs.scope "default"] | |
external component: style => ReasonReact.reactClass = "Text"; | |
include Text.CreateComponent({ | |
let view = component(Styled.style); | |
}); | |
}; |
This file contains hidden or 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
include Emotion.Text({ | |
let style = | |
Emotion.style( | |
~color=Colors.white, | |
~fontSize=20.0, | |
~margin=8.0, | |
~fontWeight="700", | |
~flex=1.0, | |
(), | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment