Created
September 12, 2017 13:57
-
-
Save WolfieZero/b81dc80c734e9f450d48262556119fe6 to your computer and use it in GitHub Desktop.
Stateless component with function example
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
// ============================================================================= | |
// Component >> Logo | |
// ============================================================================= | |
// @flow | |
// Import | |
// ============================================================================= | |
import React from 'react'; | |
import { Image } from 'react-native'; | |
import styles from './styles'; | |
// Pick Color | |
// ============================================================================= | |
const logo = (color = 'white'): number => { | |
switch (color) { | |
case 'white': | |
default: | |
return require('./assets/logo--white.png'); | |
} | |
}; | |
// Render | |
// ============================================================================= | |
export default (): React.Element<*> => | |
<Image source={logo()} style={styles.logo} />; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment