@jobber/components-native 0.95.2-JOB-141866-acfcddc.7 → 0.95.2-JOB-141866-80fe04c.8

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-80fe04c.8+80fe04c86",
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": "80fe04c86fc91e07591231460c32bc3194072bdc"
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";
@@ -39,7 +39,7 @@ import { FormSaveButton } from "./components/FormSaveButton";
39
39
  import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition";
40
40
  import { FormCache } from "./components/FormCache/FormCache";
41
41
  import { useAtlantisFormContext } from "./context/AtlantisFormContext";
42
- import { InputAccessoriesProvider, useInputAccessoriesContext, } from "../InputText";
42
+ import { InputAccessoriesProvider } from "../InputText";
43
43
  import { tokens } from "../utils/design";
44
44
  import { ErrorMessageProvider } from "../ErrorMessageWrapper";
45
45
  export function Form(_a) {
@@ -54,7 +54,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
54
54
  const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
55
55
  const [saveButtonHeight, setSaveButtonHeight] = useState(0);
56
56
  const [messageBannerHeight, setMessageBannerHeight] = useState(0);
57
- const { setIsScrolling } = useInputAccessoriesContext();
57
+ // const { setIsScrolling } = useInputAccessoriesContext();
58
58
  const { formMethods, handleSubmit, isSubmitting, removeListenerRef, setLocalCache, } = useInternalForm({
59
59
  mode,
60
60
  reValidateMode,
@@ -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),
@@ -108,11 +111,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
108
111
  (isSubmitting || isSecondaryActionLoading) && React.createElement(FormMask, null),
109
112
  React.createElement(FormCache, { localCacheKey: localCacheKey, localCacheExclude: localCacheExclude, setLocalCache: setLocalCache }),
110
113
  React.createElement(FormBody, { keyboardHeight: calculateSaveButtonOffset(), submit: handleSubmit(internalSubmit), isFormSubmitting: isSubmitting, saveButtonLabel: saveButtonLabel, shouldRenderActionBar: saveButtonPosition === "sticky", renderStickySection: renderStickySection, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, setSaveButtonHeight: setSaveButtonHeight, saveButtonOffset: saveButtonOffset },
111
- React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, enableOnAndroid: edgeToEdgeEnabled, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, extraScrollHeight: edgeToEdgeEnabled ? tokens["space-large"] : 0, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer, onScrollBeginDrag: () => {
112
- setIsScrolling(true);
113
- }, onScrollEndDrag: () => {
114
- setIsScrolling(false);
115
- } }),
114
+ React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, enableOnAndroid: edgeToEdgeEnabled, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, extraScrollHeight: edgeToEdgeEnabled ? tokens["space-large"] : 0, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
116
115
  React.createElement(View, { onLayout: ({ nativeEvent }) => {
117
116
  setFormContentHeight(nativeEvent.layout.height);
118
117
  } },
@@ -7,7 +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
10
  /**
12
11
  * Buffer zone in pixels for offscreen detection.
13
12
  * This makes the detection more sensitive by marking the component as offscreen
@@ -48,7 +47,7 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
48
47
  placeholderTextColor: "transparent",
49
48
  }));
50
49
  const _name = name !== null && name !== void 0 ? name : field.name;
51
- const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, onFocusNext, isScrolling, } = useInputAccessoriesContext();
50
+ const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, onFocusNext, } = useInputAccessoriesContext();
52
51
  useEffect(() => {
53
52
  _name &&
54
53
  register(_name, () => {
@@ -83,23 +82,40 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
83
82
  }
84
83
  const styles = useStyles();
85
84
  const commonInputStyles = useCommonInputStyles();
86
- const { headerHeight, windowHeight } = useScreenInformation();
85
+ // const { headerHeight, windowHeight } = useScreenInformation();
87
86
  // State to track if the InputText component can fully fit on screen
88
87
  // (i.e., it's completely visible). Use this state to handle visibility issues.
89
- const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
88
+ // const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
90
89
  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: [
90
+ React.createElement(TextInput
91
+ // onLayout={(event: LayoutChangeEvent) => {
92
+ // event.target?.measureInWindow((_, y, __, height) => {
93
+ // // Check if component can't fully fit on screen (height only)
94
+ // // Account for headerHeight at the top of the screen and buffer zone
95
+ // const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
96
+ // const visibleBottom =
97
+ // windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
98
+ // const isOffScreen =
99
+ // y < visibleTop || // Top edge is behind or above the header (with buffer)
100
+ // y + height > visibleBottom; // Bottom edge is below the window (with buffer)
101
+ // setCanFullyFitOnScreen(!isOffScreen);
102
+ // });
103
+ // }}
104
+ , Object.assign({
105
+ // onLayout={(event: LayoutChangeEvent) => {
106
+ // event.target?.measureInWindow((_, y, __, height) => {
107
+ // // Check if component can't fully fit on screen (height only)
108
+ // // Account for headerHeight at the top of the screen and buffer zone
109
+ // const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
110
+ // const visibleBottom =
111
+ // windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
112
+ // const isOffScreen =
113
+ // y < visibleTop || // Top edge is behind or above the header (with buffer)
114
+ // y + height > visibleBottom; // Bottom edge is below the window (with buffer)
115
+ // setCanFullyFitOnScreen(!isOffScreen);
116
+ // });
117
+ // }}
118
+ inputAccessoryViewID: inputAccessoryID || undefined, testID: testID, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, style: [
103
119
  commonInputStyles.input,
104
120
  styles.inputPaddingTop,
105
121
  !miniLabelActive && commonInputStyles.inputEmpty,
@@ -115,14 +131,13 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
115
131
  ],
116
132
  // Prevent focus during scroll for multiline inputs to avoid
117
133
  // the input focusing when the user is trying to scroll the form
118
- readOnly: readonly || (multiline && isScrolling && !focused),
119
- // readOnly={readonly}
120
- editable: !disabled, keyboardType: keyboard, value: inputTransform(internalValue), autoFocus: autoFocus, autoComplete: autoComplete, multiline: multiline,
134
+ // readOnly={readonly || (multiline && isScrolling && !focused)}
135
+ readOnly: readonly, editable: !disabled, keyboardType: keyboard, value: inputTransform(internalValue), autoFocus: autoFocus, autoComplete: autoComplete, multiline: multiline,
121
136
  // Makes sure it doesn't jump to the top of the screen when the keyboard is shown and a new line is added.
122
137
  // State for tracking if the input should be scrollable.
123
138
  // This is tech debt related to an issue where keyboard aware scrollview doesn't work if `scrollEnabled` is true. However,
124
139
  // 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 => {
140
+ 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
141
  _name && setFocusedInput(_name);
127
142
  setFocused(true);
128
143
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);