import React from 'react' import { StyleSheet, View, TouchableOpacity, Text, TouchableNativeFeedback, Platform } from 'react-native' import PropTypes from 'prop-types' const isAndroid = Platform.OS === 'android' const Button = ({ disabled, style, textStyle, disabledStyle, disabledTextStyle, text, width, height, children, background, ...otherProps }) => { if (disabled) { return ( {text || children} ) } if (isAndroid) { background = background || TouchableNativeFeedback.SelectableBackground() return ( {text || children} ) } return ( {text || children} ) } Button.propTypes = { ...TouchableOpacity.propTypes, height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), textStyle: Text.propTypes.style, disabledTextStyle: Text.propTypes.style, disabledStyle: Text.propTypes.style } Button.defaultProps = { height: 56, activeOpacity: 0.2 } const styles = StyleSheet.create({ button: { flexDirection: 'row', backgroundColor: '#212121', alignItems: 'center', borderRadius: 2, justifyContent: 'center' }, text: { color: '#fff', flex: 1, fontFamily: 'System', fontSize: 18, textAlign: 'center', backgroundColor: 'transparent' } }) export default Button