Skip to content

Instantly share code, notes, and snippets.

@hdsenevi
Last active December 10, 2018 11:11
Show Gist options
  • Save hdsenevi/00a9d7404b79dfa540b8b7512fcba3c3 to your computer and use it in GitHub Desktop.
Save hdsenevi/00a9d7404b79dfa540b8b7512fcba3c3 to your computer and use it in GitHub Desktop.
Article helper gist for "Unit testing in React Native with Jest and Enzyme" (https://github.com/hdsenevi/react-native-unit-testing-recipes)
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
const Button = (props) => {
const { buttonStyle, textStyle } = styles;
const { onPress, label } = props
return (
<TouchableOpacity onPress={onPress} style={buttonStyle}>
<Text style={textStyle}>
{label}
</Text>
</TouchableOpacity>
);
};
const styles = {
textStyle: {
alignSelf: 'center',
color: '#fff',
fontSize: 16,
fontWeight: '600',
},
buttonStyle: {
height: 45,
alignSelf: 'stretch',
justifyContent: 'center',
backgroundColor: '#38ba7d',
borderBottomWidth: 6,
borderBottomColor: '#1e6343',
borderWidth: 1,
marginLeft: 15,
marginRight: 15
}
};
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment