react-native-better-html 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1138,8 +1138,19 @@ Image2.profileImage = ImageComponent.profileImage;
1138
1138
  var Image_default = Image2;
1139
1139
 
1140
1140
  // src/components/InputField.tsx
1141
- import { forwardRef, memo as memo9, useCallback as useCallback2, useEffect as useEffect4, useImperativeHandle, useMemo as useMemo8, useState as useState2 } from "react";
1142
- import { TextInput } from "react-native";
1141
+ import {
1142
+ forwardRef,
1143
+ memo as memo9,
1144
+ useCallback as useCallback2,
1145
+ useEffect as useEffect4,
1146
+ useImperativeHandle,
1147
+ useMemo as useMemo8,
1148
+ useRef,
1149
+ useState as useState2
1150
+ } from "react";
1151
+ import {
1152
+ TextInput
1153
+ } from "react-native";
1143
1154
  import {
1144
1155
  darkenColor,
1145
1156
  lightenColor,
@@ -1163,19 +1174,30 @@ var InputFieldComponent = forwardRef(
1163
1174
  keyboardAppearance = "default",
1164
1175
  keyboardType,
1165
1176
  secureTextEntry,
1177
+ returnKeyLabel,
1178
+ returnKeyType,
1179
+ height,
1180
+ fontSize = 16,
1181
+ fontWeight = 400,
1182
+ lineHeight = 20,
1183
+ textAlign,
1184
+ paddingHorizontal,
1185
+ paddingVertical,
1166
1186
  onFocus,
1167
1187
  onBlur,
1168
- onChange
1188
+ onChange,
1189
+ onPress,
1190
+ onPressEnter
1169
1191
  }, ref) => {
1170
1192
  const theme2 = useTheme8();
1171
1193
  const { colorTheme } = useBetterCoreContext3();
1194
+ const textInputRef = useRef(null);
1172
1195
  const [internalValue, setInternalValue] = useState2(value?.toString() || defaultValue || "");
1173
1196
  const [isFocused, setIsFocused] = useBooleanState4();
1174
1197
  const borderWidth = 1;
1175
- const lineHeight = 20;
1176
- const paddingHorizontal = theme2.styles.space;
1177
- const paddingVertical = (theme2.styles.space + theme2.styles.gap) / 2;
1178
- const height = borderWidth + paddingVertical + lineHeight + paddingVertical + borderWidth;
1198
+ const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
1199
+ const readyPaddingVertical = paddingVertical ? parseFloat(paddingVertical.toString()) : (theme2.styles.space + theme2.styles.gap) / 2;
1200
+ const readyHeight = height ?? borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth;
1179
1201
  const onFocusElement = useCallback2((event) => {
1180
1202
  setIsFocused.setTrue();
1181
1203
  onFocus?.(event);
@@ -1194,13 +1216,14 @@ var InputFieldComponent = forwardRef(
1194
1216
  const textInputStyle = useMemo8(
1195
1217
  () => ({
1196
1218
  flex: 1,
1197
- fontSize: 16,
1219
+ fontSize,
1220
+ fontWeight,
1198
1221
  lineHeight,
1199
1222
  color: theme2.colors.textPrimary,
1200
- paddingHorizontal,
1201
- paddingVertical
1223
+ paddingHorizontal: readyPaddingHorizontal,
1224
+ paddingVertical: readyPaddingVertical
1202
1225
  }),
1203
- [theme2.colors, lineHeight, paddingHorizontal, paddingVertical]
1226
+ [theme2.colors, fontSize, fontWeight, lineHeight, readyPaddingHorizontal, readyPaddingVertical]
1204
1227
  );
1205
1228
  useEffect4(() => {
1206
1229
  if (value === void 0) return;
@@ -1209,12 +1232,12 @@ var InputFieldComponent = forwardRef(
1209
1232
  useImperativeHandle(
1210
1233
  ref,
1211
1234
  () => {
1212
- return {};
1235
+ return textInputRef.current;
1213
1236
  },
1214
1237
  []
1215
1238
  );
1216
1239
  const prefixSuffixBackgroundColor = colorTheme === "light" ? darkenColor(theme2.colors.backgroundContent, 0.03) : lightenColor(theme2.colors.backgroundContent, 0.1);
1217
- return /* @__PURE__ */ jsxs4(View_default, { isRow: true, position: "relative", alignItems: "center", height, children: [
1240
+ return /* @__PURE__ */ jsxs4(View_default, { isRow: true, position: "relative", alignItems: "center", flex: 1, height: readyHeight, children: [
1218
1241
  prefix && /* @__PURE__ */ jsx9(
1219
1242
  View_default,
1220
1243
  {
@@ -1227,7 +1250,7 @@ var InputFieldComponent = forwardRef(
1227
1250
  borderTopLeftRadius: theme2.styles.borderRadius,
1228
1251
  borderBottomLeftRadius: theme2.styles.borderRadius,
1229
1252
  borderColor: theme2.colors.border,
1230
- paddingHorizontal,
1253
+ paddingHorizontal: readyPaddingHorizontal,
1231
1254
  children: /* @__PURE__ */ jsx9(Text_default, { fontWeight: 700, children: prefix })
1232
1255
  }
1233
1256
  ),
@@ -1256,7 +1279,11 @@ var InputFieldComponent = forwardRef(
1256
1279
  autoFocus,
1257
1280
  placeholder,
1258
1281
  placeholderTextColor: theme2.colors.textSecondary + "80",
1282
+ enterKeyHint: returnKeyLabel,
1283
+ returnKeyType,
1284
+ onSubmitEditing: onPressEnter,
1259
1285
  readOnly: !editable,
1286
+ textAlign,
1260
1287
  keyboardAppearance,
1261
1288
  keyboardType,
1262
1289
  cursorColor: theme2.colors.primary,
@@ -1264,7 +1291,9 @@ var InputFieldComponent = forwardRef(
1264
1291
  secureTextEntry,
1265
1292
  onFocus: onFocusElement,
1266
1293
  onBlur: onBlurElement,
1267
- onChangeText
1294
+ onChangeText,
1295
+ onPress,
1296
+ ref: textInputRef
1268
1297
  }
1269
1298
  )
1270
1299
  }
@@ -1281,7 +1310,7 @@ var InputFieldComponent = forwardRef(
1281
1310
  borderTopRightRadius: theme2.styles.borderRadius,
1282
1311
  borderBottomRightRadius: theme2.styles.borderRadius,
1283
1312
  borderColor: theme2.colors.border,
1284
- paddingHorizontal,
1313
+ paddingHorizontal: readyPaddingHorizontal,
1285
1314
  children: /* @__PURE__ */ jsx9(Text_default, { fontWeight: 700, children: suffix })
1286
1315
  }
1287
1316
  )
@@ -1316,9 +1345,25 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
1316
1345
  }
1317
1346
  );
1318
1347
  });
1348
+ InputFieldComponent.code = forwardRef(function Password2(props, ref) {
1349
+ const theme2 = useTheme8();
1350
+ return /* @__PURE__ */ jsx9(
1351
+ InputFieldComponent,
1352
+ {
1353
+ fontSize: 42,
1354
+ fontWeight: 900,
1355
+ lineHeight: 50,
1356
+ paddingVertical: theme2.styles.space * 2,
1357
+ textAlign: "center",
1358
+ ...props,
1359
+ ref
1360
+ }
1361
+ );
1362
+ });
1319
1363
  var InputField = memo9(InputFieldComponent);
1320
1364
  InputField.email = InputFieldComponent.email;
1321
1365
  InputField.password = InputFieldComponent.password;
1366
+ InputField.code = InputFieldComponent.code;
1322
1367
  var InputField_default = InputField;
1323
1368
 
1324
1369
  // src/components/StatusBar.tsx