@nghinv/react-native-app-tour
Version:
React Native app tour Library
54 lines (51 loc) • 1.51 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/**
* Created by nghinv on Sat Jun 19 2021
* Copyright (c) 2021 nghinv@lumi.biz
*/
import React from 'react';
import { View, TouchableOpacity, StyleSheet, Text } from 'react-native';
import equals from 'react-fast-compare';
function ButtonText(props) {
const {
title,
disabled,
onPress,
style,
titleStyle,
buttonProps,
titleProps,
titleColor = 'green'
} = props;
const ButtonComponent = disabled || !onPress ? View : TouchableOpacity;
return /*#__PURE__*/React.createElement(ButtonComponent, _extends({
hitSlop: {
top: 4,
bottom: 4,
left: 4,
right: 4
}
}, buttonProps, {
onPress: onPress,
style: [styles.container, {
opacity: disabled ? 0.6 : 1
}, style]
}), /*#__PURE__*/React.createElement(Text, _extends({}, titleProps, {
style: [styles.title, {
color: titleColor
}, titleStyle]
}), title));
}
const styles = StyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
padding: 8
},
title: {
fontSize: 16,
fontWeight: '500'
}
});
export default /*#__PURE__*/React.memo(ButtonText, equals);
//# sourceMappingURL=ButtonText.js.map