Skip to content

Instantly share code, notes, and snippets.

@twmilli
Created May 4, 2017 23:51
Show Gist options
  • Save twmilli/5d2bace1faa1d04b1d4b5217c553a671 to your computer and use it in GitHub Desktop.
Save twmilli/5d2bace1faa1d04b1d4b5217c553a671 to your computer and use it in GitHub Desktop.
Simple Button in React Native
import React from 'react';
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
const Button = (props) => {
const { buttonStyle, textStyle } = styles;
return (
<TouchableOpacity style={buttonStyle} onPress={props.onPress}>
<Text style={textStyle}>
{props.children}
</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
textStyle: {
alignSelf: 'center',
color: '#6B7794',
fontSize: 16,
fontWeight: '600',
paddingTop: 10,
paddingBottom: 10
},
buttonStyle: {
flex: 1,
alignSelf: 'stretch',
backgroundColor: '#fff',
borderWidth: 1,
borderRadius: 5,
borderColor: '#6B7794',
margin: 5,
marginRight: 5
}
});
export { Button };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment