Skip to content

Instantly share code, notes, and snippets.

@WolfieZero
Created September 12, 2017 13:57
Show Gist options
  • Save WolfieZero/b81dc80c734e9f450d48262556119fe6 to your computer and use it in GitHub Desktop.
Save WolfieZero/b81dc80c734e9f450d48262556119fe6 to your computer and use it in GitHub Desktop.
Stateless component with function example
// =============================================================================
// 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