@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.
@@ -6,6 +6,11 @@ import type { RegisterOptions } from "react-hook-form";
6
6
  import type { IconNames } from "@jobber/design";
7
7
  import type { Clearable } from "@jobber/hooks";
8
8
  import type { InputFieldStyleOverride, InputFieldWrapperProps } from "../InputFieldWrapper/InputFieldWrapper";
9
+ /**
10
+ * Buffer zone in pixels for offscreen detection.
11
+ * This makes the detection more sensitive by marking the component as offscreen
12
+ * even if it's technically still visible but within this buffer distance from the edge.
13
+ */
9
14
  export interface InputTextProps extends Pick<InputFieldWrapperProps, "toolbar" | "toolbarVisibility" | "loading" | "loadingType"> {
10
15
  /**
11
16
  * Highlights the field red and shows message below (if string) to indicate an error
package/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
  }
package/src/Form/Form.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useMemo, useState } from "react";
2
2
  import type { FieldValues } from "react-hook-form";
3
3
  import { FormProvider } from "react-hook-form";
4
4
  import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
@@ -111,8 +111,12 @@ function InternalForm<T extends FieldValues, S>({
111
111
  const [isSecondaryActionLoading, setIsSecondaryActionLoading] =
112
112
  useState<boolean>(false);
113
113
 
114
- const extraViewHeight = paddingBottom + KEYBOARD_SAVE_BUTTON_DISTANCE;
115
- const calculatedKeyboardHeight = keyboardHeight - extraViewHeight;
114
+ const { calculatedKeyboardHeight } = useMemo(() => {
115
+ return {
116
+ calculatedKeyboardHeight:
117
+ keyboardHeight - (paddingBottom + KEYBOARD_SAVE_BUTTON_DISTANCE),
118
+ };
119
+ }, [paddingBottom, keyboardHeight]);
116
120
 
117
121
  useScrollToError({
118
122
  formState: formMethods.formState,
@@ -9,7 +9,6 @@ import React, {
9
9
  } from "react";
10
10
  import type {
11
11
  FocusEvent,
12
- LayoutChangeEvent,
13
12
  ReturnKeyTypeOptions,
14
13
  StyleProp,
15
14
  TextInputProps,
@@ -30,7 +29,7 @@ import type {
30
29
  } from "../InputFieldWrapper/InputFieldWrapper";
31
30
  import { InputFieldWrapper } from "../InputFieldWrapper";
32
31
  import { useCommonInputStyles } from "../InputFieldWrapper/CommonInputStyles.style";
33
- import { useScreenInformation } from "../Form/hooks/useScreenInformation";
32
+ // import { useScreenInformation } from "../Form/hooks/useScreenInformation";
34
33
 
35
34
  /**
36
35
  * Buffer zone in pixels for offscreen detection.
@@ -38,7 +37,7 @@ import { useScreenInformation } from "../Form/hooks/useScreenInformation";
38
37
  * even if it's technically still visible but within this buffer distance from the edge.
39
38
  */
40
39
  // 44 (accessory bar height) + 20 (buffer)
41
- const KEYBOARD_AWARE_DETECTION_BUFFER = 64;
40
+ // const KEYBOARD_AWARE_DETECTION_BUFFER = 64;
42
41
 
43
42
  export interface InputTextProps
44
43
  extends Pick<
@@ -342,8 +341,8 @@ function InputTextInternal(
342
341
  unregister,
343
342
  setFocusedInput,
344
343
  canFocusNext,
345
- onFocusNext,
346
344
  isScrolling,
345
+ onFocusNext,
347
346
  } = useInputAccessoriesContext();
348
347
  useEffect(() => {
349
348
  _name &&
@@ -383,10 +382,10 @@ function InputTextInternal(
383
382
 
384
383
  const styles = useStyles();
385
384
  const commonInputStyles = useCommonInputStyles();
386
- const { headerHeight, windowHeight } = useScreenInformation();
385
+ // const { headerHeight, windowHeight } = useScreenInformation();
387
386
  // State to track if the InputText component can fully fit on screen
388
387
  // (i.e., it's completely visible). Use this state to handle visibility issues.
389
- const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
388
+ // const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
390
389
 
391
390
  return (
392
391
  <InputFieldWrapper
@@ -409,20 +408,20 @@ function InputTextInternal(
409
408
  loadingType={loadingType}
410
409
  >
411
410
  <TextInput
412
- onLayout={(event: LayoutChangeEvent) => {
413
- event.target?.measureInWindow((_, y, __, height) => {
414
- // Check if component can't fully fit on screen (height only)
415
- // Account for headerHeight at the top of the screen and buffer zone
416
- const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
417
- const visibleBottom =
418
- windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
419
- const isOffScreen =
420
- y < visibleTop || // Top edge is behind or above the header (with buffer)
421
- y + height > visibleBottom; // Bottom edge is below the window (with buffer)
422
-
423
- setCanFullyFitOnScreen(!isOffScreen);
424
- });
425
- }}
411
+ // onLayout={(event: LayoutChangeEvent) => {
412
+ // event.target?.measureInWindow((_, y, __, height) => {
413
+ // // Check if component can't fully fit on screen (height only)
414
+ // // Account for headerHeight at the top of the screen and buffer zone
415
+ // const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
416
+ // const visibleBottom =
417
+ // windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
418
+ // const isOffScreen =
419
+ // y < visibleTop || // Top edge is behind or above the header (with buffer)
420
+ // y + height > visibleBottom; // Bottom edge is below the window (with buffer)
421
+
422
+ // setCanFullyFitOnScreen(!isOffScreen);
423
+ // });
424
+ // }}
426
425
  inputAccessoryViewID={inputAccessoryID || undefined}
427
426
  testID={testID}
428
427
  autoCapitalize={autoCapitalize}
@@ -456,7 +455,7 @@ function InputTextInternal(
456
455
  // State for tracking if the input should be scrollable.
457
456
  // This is tech debt related to an issue where keyboard aware scrollview doesn't work if `scrollEnabled` is true. However,
458
457
  // 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.
459
- scrollEnabled={Platform.OS === "ios" && !canFullyFitOnScreen}
458
+ scrollEnabled={Platform.OS === "ios"}
460
459
  textContentType={textContentType}
461
460
  onChangeText={handleChangeText}
462
461
  onSubmitEditing={handleOnSubmitEditing}