Skip to content

Instantly share code, notes, and snippets.

@atticoos
Last active May 17, 2017 23:05
Show Gist options
  • Save atticoos/42d35f0a1c01e456965c4f4ef5e79c42 to your computer and use it in GitHub Desktop.
Save atticoos/42d35f0a1c01e456965c4f4ef5e79c42 to your computer and use it in GitHub Desktop.
glamorous-native before and after
import glamorous from 'glamorous-native'
const style = StyleSheet.create({
baseStyle: {
color: '#333',
// some other "base styles"
}
})
const Text = glamorous.text(
// normal stylesheet styles
styles.baseStyle,
// dynamic styles
props => ({fontSize: props.big ? 32 : 24}),
// ...more styles
)
export default Text
import {Text} from 'react-native'
function BaseText ({style, big, ...props}) {
return (
<Text
// yawwwwn
style={[styles.baseStyle, {fontSize: big ? 32 : 24}, style]}
{...props}
/>
)
}
const style = StyleSheet.create({
baseStyle: {
color: '#333',
// some other "base styles"
}
})
export default BaseText
import Text from 'before or after'
function SomeUserInterface() {
return (
<Text
style={styles.anExternallyProvidedStyle}
big
>
Large Text
</Text>
)
}
const styles = StyleSheet.create({
anExternallyProvidedStyle: {...}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment