Skip to content

Instantly share code, notes, and snippets.

@wolverineks
Last active October 14, 2017 00:01
Show Gist options
  • Save wolverineks/ee21b728069061b5041b4615a9e86916 to your computer and use it in GitHub Desktop.
Save wolverineks/ee21b728069061b5041b4615a9e86916 to your computer and use it in GitHub Desktop.
React Alias Components
import React, {Component} from 'react'
import Icon from '...'
import {
Text,
TouchableOpacity,
View
} from 'react-native'
import styles from './styles'
const SUBMIT_TEXT = '...'
const CANCEL_TEXT = '...'
export default Alert extends Component {
render () {
<View style={styles.alertContainer}>
<View style={styles.alertHeader}>
<Icon src='...' style={styles.alertIcon} />
<Text style={styles.alertText}>{alertHeaderText}</Text>
</View>
<View style={styles.alertBody}>
<Text style={styles.alertText}>{alertBodyText}</Text>
</View>
<View style={styles.alertFooter}>
<TouchableHighlight style={[styles.alertButton, styles.cancelButton]} onPress={...}>
<Text style={[styles.buttonText, styles.cancelButtonText]}>
{CANCEL_TEXT}
</Text>
</TouchableHighlight>
<TouchableHighlight style={[styles.alertButton, styles.submitButton]} onPress={...}>
<Text styles={[styles.buttonText, styles.submitButtonText]}>
{SUBMIT_TEXT}
</Text>
</TouchableHighlight>
</View>
</View>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment