UNPKG

rn-inkpad

Version:

<img src="https://res.cloudinary.com/fercloudinary/image/upload/v1715452841/packages/inkpad-banner_acl0xl.png" />

35 lines (34 loc) 1.73 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Button = void 0; const react_1 = __importDefault(require("react")); const react_native_1 = require("react-native"); const hooks_1 = require("../../hooks"); const theme_1 = require("../../theme"); const Icon_1 = require("../icon/Icon"); const Button = ({ activeOpacity = 0.6, buttonColor, buttonType, disabled, full, icon, color, iconSize, iconPosition = 'left', loading, rounded, spinnerSize, style, text = 'Button', textStyle, onPress, }) => { const { backgroundColor, borderColor, borderWidth, textColor } = (0, hooks_1.useButtonType)(buttonColor, color, buttonType, disabled); return (<react_native_1.TouchableOpacity activeOpacity={activeOpacity} onPress={onPress} disabled={disabled} style={[ theme_1.buttonStyles.button, { backgroundColor, borderColor, borderWidth, borderRadius: rounded ? 100 : 0, flexDirection: iconPosition === 'left' ? 'row' : 'row-reverse', width: full ? '100%' : 'auto', }, style, ]}> {loading ? (<react_native_1.ActivityIndicator color={color} size={spinnerSize}/>) : (<> {!!icon && <Icon_1.Icon name={icon} size={iconSize} color={textColor}/>} {!!text && (<react_native_1.Text style={[theme_1.buttonStyles.text, { color: textColor }, textStyle]}> {text} </react_native_1.Text>)} </>)} </react_native_1.TouchableOpacity>); }; exports.Button = Button;