Skip to content

Instantly share code, notes, and snippets.

@jdspiral
Created October 18, 2017 17:40
Show Gist options
  • Save jdspiral/b1cd0687e9f5f31a21586eb7292e4786 to your computer and use it in GitHub Desktop.
Save jdspiral/b1cd0687e9f5f31a21586eb7292e4786 to your computer and use it in GitHub Desktop.
Create Custom Button Colors
import React, { Component } from 'react';
import {
Text,
TouchableOpacity
} from 'react-native';
const Button = (props) => {
const { button, text } = styles;
return (
<TouchableOpacity {...props} style={[button, props.buttonStyle]}>
<Text style={[text, props.textStyle]}>
{props.children}
</Text>
</TouchableOpacity>
);
};
const styles = {
text: {
alignSelf: 'center',
color: '#007aff',
fontSize: 16,
fontWeight: '600',
paddingBottom: 10,
paddingLeft: 70,
paddingRight: 70,
paddingTop: 10,
},
button: {
alignSelf: 'stretch',
backgroundColor: "#fff",
borderRadius: 5,
borderWidth: 1,
borderColor: '#007aff',
marginLeft: 5,
marginRight: 5
},
brown: {
color: 'maroon',
},
brownButton: {
width: 100,
height: 60,
backgroundColor: 'seashell',
justifyContent: 'center',
alignItems: 'center',
marginVertical: 15,
},
}
Button.Brown = (props) => (
<Button
{...props}
header="Click here"
buttonStyle={styles.brownButton}
textColor={styles.brown}
/>
);
export { Button };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment