UNPKG

omnipay-savings-sdk

Version:

Omnipay Savings SDK

51 lines (50 loc) 2.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const react_native_1 = require("react-native"); const Button_1 = require("../Button"); const Text_1 = require("../Text"); const utils_1 = require("../../utils"); const SDKConfigContext_1 = require("../../contexts/SDKConfigContext"); const RadioButton = ({ label, selected, onPress, containerStyle, }) => { const { primaryColor } = (0, SDKConfigContext_1.useSDKConfig)(); return ((0, jsx_runtime_1.jsx)(Button_1.CustomPressable, Object.assign({ onPress: onPress, activeOpacity: 0.8 }, { children: (0, jsx_runtime_1.jsxs)(react_native_1.View, Object.assign({ style: [styles.radioButton, containerStyle] }, { children: [!selected && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [ styles.radioButtonInner, { borderColor: primaryColor, }, ] })), selected && ((0, jsx_runtime_1.jsx)(react_native_1.View, Object.assign({ style: [ styles.radioButtonInner, { borderColor: primaryColor, }, ] }, { children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [ styles.radioButtonSelected, { backgroundColor: primaryColor, borderColor: primaryColor, }, ] }) }))), typeof label === 'string' ? ((0, jsx_runtime_1.jsx)(Text_1.Text, { fontSize: (0, utils_1.fontSz)(12), fontFamily: "Gordita-Medium", fontWeight: "400", text: `${label}`, color: utils_1.Colors.inputBackground })) : (label)] })) }))); }; const styles = react_native_1.StyleSheet.create({ radioButton: { flexDirection: 'row', alignItems: 'center', marginVertical: (0, utils_1.ms)(5), }, radioButtonInner: { width: (0, utils_1.ms)(22), height: (0, utils_1.ms)(22), borderRadius: (0, utils_1.ms)(22 / 2), borderWidth: (0, utils_1.ms)(1.5), marginRight: (0, utils_1.ms)(10), justifyContent: 'center', alignItems: 'center', }, radioButtonSelected: { width: '60%', height: '60%', borderRadius: (0, utils_1.ms)(22 / 2), }, }); exports.default = RadioButton;