UNPKG

rn-inkpad

Version:

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

51 lines (50 loc) 2.35 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LongPressButton = void 0; const react_1 = __importDefault(require("react")); const react_native_1 = require("react-native"); const __1 = require("../"); const hooks_1 = require("../../hooks"); const theme_1 = require("../../theme"); const LongPressButton = ({ backgroundColor = '#464EE5', behavior = 'left-to-right', borderRadius = 20, fontSize = 14, fullWidth, height = 40, icon, iconPosition = 'left', longPressTime, onFinish, progressColor = 'rgba(255, 255, 255, 0.3)', style, text = 'Button', textColor = '#FFF', width = '50%', }) => { const { alignSelf, handlePressIn, handlePressOut, number, scaleValue } = (0, hooks_1.useLongPressButton)(longPressTime, onFinish); return (<react_native_1.Animated.View style={[ { width: '100%', alignItems: 'center', transform: [{ scale: scaleValue }], }, style, ]}> <react_native_1.TouchableWithoutFeedback onPressIn={handlePressIn} onPressOut={handlePressOut}> <react_native_1.View style={{ ...theme_1.longPressButtonStyles.button, width: fullWidth ? '100%' : width, height, backgroundColor, borderRadius, }}> <react_native_1.View style={[ theme_1.longPressButtonStyles.progress, { width: `${number}%`, borderRadius, backgroundColor: progressColor, alignSelf: alignSelf[behavior], }, ]}></react_native_1.View> <react_native_1.View style={{ ...theme_1.longPressButtonStyles.buttonContent, flexDirection: iconPosition === 'left' ? 'row' : 'row-reverse', }}> {!!icon && (<__1.Icon name={icon} color={textColor} size={fontSize + 1}/>)} <react_native_1.Text style={{ color: textColor, fontSize }}>{text}</react_native_1.Text> </react_native_1.View> </react_native_1.View> </react_native_1.TouchableWithoutFeedback> </react_native_1.Animated.View>); }; exports.LongPressButton = LongPressButton;