Skip to content

Instantly share code, notes, and snippets.

@threepointone
Last active August 31, 2017 02:33
Show Gist options
  • Save threepointone/ec7febc17f02fd91dcbabc087519088e to your computer and use it in GitHub Desktop.
Save threepointone/ec7febc17f02fd91dcbabc087519088e to your computer and use it in GitHub Desktop.
glamor for react-native?
import { View, Text } from 'react-native'
import { css } from 'glamor-native'
export App = () => {
<View style={css({ color: 'red' })}>
<Text>Hello world!</Text>
</View>
}
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