@jobber/components-native 0.95.2-JOB-141866-acfcddc.7 → 0.95.2-JOB-141866-990fa70.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.95.2-JOB-141866-acfcddc.7+acfcddc57",
3
+ "version": "0.95.2-JOB-141866-990fa70.9+990fa7081",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -96,5 +96,5 @@
96
96
  "react-native-safe-area-context": "^5.4.0",
97
97
  "react-native-svg": ">=12.0.0"
98
98
  },
99
- "gitHead": "acfcddc57c91d179ef43e2ed44fd25bd3cae6405"
99
+ "gitHead": "990fa708191391b1d9f973c5eccd4dd8ec532424"
100
100
  }
@@ -18,7 +18,7 @@ var __rest = (this && this.__rest) || function (s, e) {
18
18
  }
19
19
  return t;
20
20
  };
21
- import React, { useState } from "react";
21
+ import React, { useMemo, useState } from "react";
22
22
  import { FormProvider } from "react-hook-form";
23
23
  import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
24
24
  import { Keyboard, Platform, View, findNodeHandle } from "react-native";
@@ -82,8 +82,11 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
82
82
  keyboardScreenY,
83
83
  });
84
84
  const [isSecondaryActionLoading, setIsSecondaryActionLoading] = useState(false);
85
- const extraViewHeight = paddingBottom + KEYBOARD_SAVE_BUTTON_DISTANCE;
86
- const calculatedKeyboardHeight = keyboardHeight - extraViewHeight;
85
+ const { calculatedKeyboardHeight } = useMemo(() => {
86
+ return {
87
+ calculatedKeyboardHeight: keyboardHeight - (paddingBottom + KEYBOARD_SAVE_BUTTON_DISTANCE),
88
+ };
89
+ }, [paddingBottom, keyboardHeight]);
87
90
  useScrollToError({
88
91
  formState: formMethods.formState,
89
92
  refNode: findNodeHandle(scrollViewRef.current),
@@ -7,14 +7,6 @@ import { useInputAccessoriesContext } from "./context";
7
7
  import { useFormController } from "../hooks";
8
8
  import { InputFieldWrapper } from "../InputFieldWrapper";
9
9
  import { useCommonInputStyles } from "../InputFieldWrapper/CommonInputStyles.style";
10
- import { useScreenInformation } from "../Form/hooks/useScreenInformation";
11
- /**
12
- * Buffer zone in pixels for offscreen detection.
13
- * This makes the detection more sensitive by marking the component as offscreen
14
- * even if it's technically still visible but within this buffer distance from the edge.
15
- */
16
- // 44 (accessory bar height) + 20 (buffer)
17
- const KEYBOARD_AWARE_DETECTION_BUFFER = 64;
18
10
  export const InputText = forwardRef(InputTextInternal);
19
11
  // eslint-disable-next-line max-statements
20
12
  function InputTextInternal({ invalid, disabled, readonly = false, name, placeholder, assistiveText, showMiniLabel = true, keyboard, value: controlledValue, defaultValue, autoFocus, autoComplete = "off", spellCheck, textContentType = "none", validations, onChangeText, onSubmitEditing, onFocus, accessibilityLabel, accessibilityHint, autoCorrect, autoCapitalize, onBlur, multiline = false, prefix, suffix, transform = {}, clearable = multiline ? "never" : "while-editing", testID, secureTextEntry, styleOverride, toolbar, toolbarVisibility, loading, loadingType, }, ref) {
@@ -48,7 +40,7 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
48
40
  placeholderTextColor: "transparent",
49
41
  }));
50
42
  const _name = name !== null && name !== void 0 ? name : field.name;
51
- const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, onFocusNext, isScrolling, } = useInputAccessoriesContext();
43
+ const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, isScrolling, onFocusNext, } = useInputAccessoriesContext();
52
44
  useEffect(() => {
53
45
  _name &&
54
46
  register(_name, () => {
@@ -83,23 +75,40 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
83
75
  }
84
76
  const styles = useStyles();
85
77
  const commonInputStyles = useCommonInputStyles();
86
- const { headerHeight, windowHeight } = useScreenInformation();
78
+ // const { headerHeight, windowHeight } = useScreenInformation();
87
79
  // State to track if the InputText component can fully fit on screen
88
80
  // (i.e., it's completely visible). Use this state to handle visibility issues.
89
- const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
81
+ // const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
90
82
  return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, placeholderMode: placeholderMode, assistiveText: assistiveText, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, onClear: handleClear, showClearAction: showClear, styleOverride: styleOverride, toolbar: toolbar, toolbarVisibility: toolbarVisibility, loading: loading, loadingType: loadingType },
91
- React.createElement(TextInput, Object.assign({ onLayout: (event) => {
92
- var _a;
93
- (_a = event.target) === null || _a === void 0 ? void 0 : _a.measureInWindow((_, y, __, height) => {
94
- // Check if component can't fully fit on screen (height only)
95
- // Account for headerHeight at the top of the screen and buffer zone
96
- const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
97
- const visibleBottom = windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
98
- const isOffScreen = y < visibleTop || // Top edge is behind or above the header (with buffer)
99
- y + height > visibleBottom; // Bottom edge is below the window (with buffer)
100
- setCanFullyFitOnScreen(!isOffScreen);
101
- });
102
- }, inputAccessoryViewID: inputAccessoryID || undefined, testID: testID, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, style: [
83
+ React.createElement(TextInput
84
+ // onLayout={(event: LayoutChangeEvent) => {
85
+ // event.target?.measureInWindow((_, y, __, height) => {
86
+ // // Check if component can't fully fit on screen (height only)
87
+ // // Account for headerHeight at the top of the screen and buffer zone
88
+ // const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
89
+ // const visibleBottom =
90
+ // windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
91
+ // const isOffScreen =
92
+ // y < visibleTop || // Top edge is behind or above the header (with buffer)
93
+ // y + height > visibleBottom; // Bottom edge is below the window (with buffer)
94
+ // setCanFullyFitOnScreen(!isOffScreen);
95
+ // });
96
+ // }}
97
+ , Object.assign({
98
+ // onLayout={(event: LayoutChangeEvent) => {
99
+ // event.target?.measureInWindow((_, y, __, height) => {
100
+ // // Check if component can't fully fit on screen (height only)
101
+ // // Account for headerHeight at the top of the screen and buffer zone
102
+ // const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
103
+ // const visibleBottom =
104
+ // windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
105
+ // const isOffScreen =
106
+ // y < visibleTop || // Top edge is behind or above the header (with buffer)
107
+ // y + height > visibleBottom; // Bottom edge is below the window (with buffer)
108
+ // setCanFullyFitOnScreen(!isOffScreen);
109
+ // });
110
+ // }}
111
+ inputAccessoryViewID: inputAccessoryID || undefined, testID: testID, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, style: [
103
112
  commonInputStyles.input,
104
113
  styles.inputPaddingTop,
105
114
  !miniLabelActive && commonInputStyles.inputEmpty,
@@ -122,7 +131,7 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
122
131
  // State for tracking if the input should be scrollable.
123
132
  // This is tech debt related to an issue where keyboard aware scrollview doesn't work if `scrollEnabled` is true. However,
124
133
  // when `scrollEnabled` is false it causes an issue where super long text inputs will jump to the top when a new line is added to the bottom of the input.
125
- scrollEnabled: Platform.OS === "ios" && !canFullyFitOnScreen, textContentType: textContentType, onChangeText: handleChangeText, onSubmitEditing: handleOnSubmitEditing, returnKeyType: returnKeyType, blurOnSubmit: shouldBlurOnSubmit, accessibilityLabel: accessibilityLabel || placeholder, accessibilityHint: accessibilityHint, accessibilityState: { busy: loading }, secureTextEntry: secureTextEntry }, androidA11yProps, { onFocus: event => {
134
+ scrollEnabled: Platform.OS === "ios", textContentType: textContentType, onChangeText: handleChangeText, onSubmitEditing: handleOnSubmitEditing, returnKeyType: returnKeyType, blurOnSubmit: shouldBlurOnSubmit, accessibilityLabel: accessibilityLabel || placeholder, accessibilityHint: accessibilityHint, accessibilityState: { busy: loading }, secureTextEntry: secureTextEntry }, androidA11yProps, { onFocus: event => {
126
135
  _name && setFocusedInput(_name);
127
136
  setFocused(true);
128
137
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);