UNPKG

@nexara/nativeflow

Version:

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

92 lines (91 loc) 2.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireDefault(require("react")); var _reactNative = require("react-native"); var _index = require("../StyledComponents/index.js"); var _ResponsiveCalculations = require("../../helpers/ResponsiveCalculations.js"); var _index2 = require("../../hooks/index.js"); var _utils = require("./utils.js"); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const Chip = ({ title = 'Chip', bg, titleColor, fs, br = 7, gap = 7, paddingV = 9, paddingH = 13, stroke = 0.9, strokeColor, rippleColor, disabled = false, renderLeftIcon, renderRightIcon, containerStyle, textStyle, ...rest }) => { const theme = (0, _index2.useTheme)(); const { buttonTextColor, buttonBorderColor, backgroundColor } = (0, _utils.getChipColors)({ theme, bg, titleColor, strokeColor, disabled }); const STYLES = _reactNative.StyleSheet.create({ CONTAINER: { flexDirection: 'row', alignItems: 'center', borderWidth: stroke, borderColor: buttonBorderColor, backgroundColor: backgroundColor, borderRadius: (0, _ResponsiveCalculations.verticalScale)(br), paddingVertical: (0, _ResponsiveCalculations.verticalScale)(paddingV), paddingHorizontal: (0, _ResponsiveCalculations.horizontalScale)(paddingH), gap: (0, _ResponsiveCalculations.horizontalScale)(gap) }, TEXT: { color: buttonTextColor } }); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StyledView, { alignSelf: "flex-start", children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, { android_ripple: { color: rippleColor }, ...rest, disabled: disabled, children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.StyledView, { style: [STYLES.CONTAINER, containerStyle], children: [renderLeftIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, { disabled: disabled, children: renderLeftIcon }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StyledText, { primary: true, variant: "h5", fs: fs, style: [STYLES.TEXT, textStyle], children: title }), renderRightIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, { disabled: disabled, children: renderRightIcon })] }) }) }) }); }; var _default = exports.default = Chip; //# sourceMappingURL=Chip.js.map