UNPKG

omnipay-savings-sdk

Version:

Omnipay Savings SDK

22 lines (21 loc) 3.02 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 utils_1 = require("../../utils"); const Text_1 = require("../Text"); const Input = (props) => { const { value, containerStyle, style, label, placeholder, inputStyle, prependComponent, appendComponent, onChange, onEndEditing, onFocus, secureTextEntry, keyboardType = 'default', autoCompleteType = 'off', autoCapitalize = 'none', errorMsg = '', multiline = false, numberOfLines = 1, isLoading = false, returnKeyLabel, returnKeyType, editable = true, maxLength, showAsterisk, } = props; return ((0, jsx_runtime_1.jsxs)(react_native_1.View, Object.assign({ style: Object.assign({ position: 'relative', paddingBottom: (0, utils_1.ms)(8) }, containerStyle) }, { children: [label && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: typeof label === 'string' ? ((0, jsx_runtime_1.jsxs)(react_native_1.Text, Object.assign({ style: { fontSize: (0, utils_1.fontSz)(14), fontFamily: 'Gordita-Regular', fontWeight: '400', color: utils_1.Colors.inputBackgroundLight, } }, { children: [label, showAsterisk && ((0, jsx_runtime_1.jsx)(Text_1.Text, { fontSize: (0, utils_1.fontSz)(14), fontFamily: "Gordita-Regular", fontWeight: "400", text: '*', color: utils_1.Colors.debitRed }))] }))) : (label) })), (0, jsx_runtime_1.jsxs)(react_native_1.View, Object.assign({ style: Object.assign({ flexDirection: 'row', height: (0, utils_1.hp)(55), paddingHorizontal: (0, utils_1.ms)(14), marginTop: (0, utils_1.ms)(4), borderRadius: (0, utils_1.ms)(8), borderColor: errorMsg.length > 0 ? utils_1.Colors.error : '#F4F4F4', borderWidth: (0, utils_1.ms)(1), backgroundColor: '#F4F4F4' }, style) }, { children: [prependComponent, (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: Object.assign(Object.assign({ flex: 1 }, inputStyle), { color: utils_1.Colors.baseBlueText, fontFamily: 'Gordita-Medium', opacity: editable ? 1 : 0.5 }), placeholder: placeholder, value: value, placeholderTextColor: '#C4C4C4', onChangeText: text => onChange(text), onEndEditing: text => onEndEditing(text), onFocus: text => onFocus(), secureTextEntry: secureTextEntry, keyboardType: keyboardType, autoComplete: autoCompleteType, autoCapitalize: autoCapitalize, multiline: multiline, numberOfLines: numberOfLines, returnKeyLabel: returnKeyLabel, returnKeyType: returnKeyType, editable: editable, maxLength: maxLength }), appendComponent] })), (0, jsx_runtime_1.jsx)(Text_1.Text, { style: { // paddingTop: ms(2.5), position: 'absolute', bottom: (0, utils_1.ms)(-10), left: 0, }, fontSize: (0, utils_1.fontSz)(14), fontFamily: "Gordita-Regular", fontWeight: "400", text: `${errorMsg}`, color: utils_1.Colors.error })] }))); }; exports.default = Input;