UNPKG

react-native-ios-utilities

Version:

Utilities for react-native + iOS and wrappers for using swift together with fabric/paper + JSI

94 lines (93 loc) 3.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CardRowStepper = CardRowStepper; var React = _interopRequireWildcard(require("react")); var _reactNative = require("react-native"); var _Colors = require("../misc/Colors.js"); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } function CardRowStepper(props) { return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { style: styles.cardRowStepperContainer, children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { style: styles.cardRowStepperLabelContainer, children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.cardRowStepperLabelText, children: props.title ?? 'Title' }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.cardRowStepperSubtitleText, children: props.subtitle ?? `Current value: ${props.value ?? 0}` })] }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { style: styles.cardRowStepperButtonsContainer, children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, { style: [styles.cardRowStepperButton, styles.cardRowStepperButtonLeft], onPress: () => { props.onValueChange(props.value - props.stepperAmount); }, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.cardRowStepperButtonLabel, children: '–' }) }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, { style: [styles.cardRowStepperButton, styles.cardRowStepperButtonRight], onPress: () => { props.onValueChange(props.value + props.stepperAmount); }, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.cardRowStepperButtonLabel, children: '+' }) })] })] }); } ; const styles = _reactNative.StyleSheet.create({ cardRowStepperContainer: { flexDirection: 'row', alignItems: 'center', marginTop: 12 }, cardRowStepperLabelContainer: { flex: 1 }, cardRowStepperLabelText: { fontSize: 12, fontWeight: '500', color: _Colors.Colors.PURPLE[1200] }, cardRowStepperSubtitleText: { flex: 1, fontSize: 12, opacity: 0.5, color: _Colors.Colors.PURPLE[1100] }, cardRowStepperButtonsContainer: { flexDirection: 'row', overflow: 'hidden', borderRadius: 10 }, cardRowStepperButton: { padding: 10, backgroundColor: _Colors.Colors.PURPLE.A200, width: 45, alignItems: 'center', justifyContent: 'center' }, cardRowStepperButtonLeft: { marginRight: 0.5 }, cardRowStepperButtonRight: { marginLeft: 0.5 }, cardRowStepperButtonLabel: { fontWeight: '500', color: 'white', opacity: 0.9, fontSize: 16 } }); //# sourceMappingURL=CardRowStepper.js.map