Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.