Last active
January 6, 2019 11:37
-
-
Save koenpunt/afbe4a3ba264d3eaed2b5f67fc4cb303 to your computer and use it in GitHub Desktop.
React composition for inheritance
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
const MyText = ({ style, ...props }) => ( | |
<Text style={[styles.myText, style]} {...props} /> | |
); | |
const LargerText = ({ style, ...props }) => ( | |
<MyText style={[styles.largerText, style]} {...props} /> | |
); | |
const styles = StyleSheet.create({ | |
myText: { | |
fontFamily: 'Arial Black', | |
fontSize: 14, | |
}, | |
largerText: { | |
fontSize: 20, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment