Last active
August 31, 2017 02:33
-
-
Save threepointone/ec7febc17f02fd91dcbabc087519088e to your computer and use it in GitHub Desktop.
glamor for react-native?
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
import { View, Text } from 'react-native' | |
import { css } from 'glamor-native' | |
export App = () => { | |
<View style={css({ color: 'red' })}> | |
<Text>Hello world!</Text> | |
</View> | |
} |
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
import { StyleSheet } from 'react-native' | |
import hashify from 'glamor/lib/hash' | |
export const css = o => { | |
const hash = hashify(o) | |
let sheet = Stylesheet.create({ [hash]: o}) | |
return sheet[hash] | |
// you'd also memoize this function on hash/ident/etc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment