UNPKG

@nexara/nativeflow

Version:

Beautiful, responsive, and customizable UI components for React Native – built for performance and seamless experiences.

77 lines (76 loc) 2.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = require("react"); var _index = require("../StyledComponents/index.js"); var _reactNative = require("react-native"); var _index2 = require("../../helpers/index.js"); var _index3 = require("../../hooks/index.js"); var _jsxRuntime = require("react/jsx-runtime"); const RadioItem = ({ size = 22, stroke = 2, color, active = false, name, disabled, label, fs, fScale = 'base', ff, labelStyle, ...rest }) => { const STYLES = (0, _react.useMemo)(customStyles, []); const theme = (0, _index3.useTheme)(); const themedColor = disabled && theme?.colors.states.disabled || (color ?? theme?.colors.brand.primary); const dynamicStyles = { borderColor: themedColor, borderWidth: stroke, padding: 2, height: size, width: size }; return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, { ...rest, children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.StyledView, { style: STYLES.MAIN_CONT, children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StyledView, { style: [STYLES.RADIO_OUTER_CONT, dynamicStyles], children: active && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StyledView, { style: [STYLES.RADIO_INNER_CONT], bg: themedColor }) }), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StyledText, { variant: disabled ? 'disabled' : 'primary', ff: ff, fs: fs, fScale: fScale, style: labelStyle, children: label })] }) }) }); }; var _default = exports.default = RadioItem; const customStyles = () => _reactNative.StyleSheet.create({ MAIN_CONT: { flexDirection: 'row', gap: (0, _index2.horizontalScale)(15), alignItems: 'center' }, RADIO_OUTER_CONT: { borderRadius: 100, overflow: 'hidden' }, RADIO_INNER_CONT: { width: '100%', height: '100%', borderRadius: 100 } }); //# sourceMappingURL=RadioItem.js.map