Last active
May 17, 2017 23:05
-
-
Save atticoos/42d35f0a1c01e456965c4f4ef5e79c42 to your computer and use it in GitHub Desktop.
glamorous-native before and after
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 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 |
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 {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 |
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 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