@jobber/components-native 0.95.2-JOB-141866-80fe04c.8 → 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 +2 -2
- package/dist/src/Form/Form.js +7 -3
- package/dist/src/InputText/InputText.js +4 -10
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/InputText/InputText.d.ts +5 -0
- package/package.json +2 -2
- package/src/Form/Form.tsx +11 -8
- package/src/InputText/InputText.tsx +5 -4
|
@@ -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-
|
|
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": "
|
|
99
|
+
"gitHead": "990fa708191391b1d9f973c5eccd4dd8ec532424"
|
|
100
100
|
}
|
package/src/Form/Form.tsx
CHANGED
|
@@ -26,7 +26,10 @@ import { FormSaveButton } from "./components/FormSaveButton";
|
|
|
26
26
|
import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition";
|
|
27
27
|
import { FormCache } from "./components/FormCache/FormCache";
|
|
28
28
|
import { useAtlantisFormContext } from "./context/AtlantisFormContext";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
InputAccessoriesProvider,
|
|
31
|
+
useInputAccessoriesContext,
|
|
32
|
+
} from "../InputText";
|
|
30
33
|
import { tokens } from "../utils/design";
|
|
31
34
|
import { ErrorMessageProvider } from "../ErrorMessageWrapper";
|
|
32
35
|
|
|
@@ -70,7 +73,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
70
73
|
const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
|
|
71
74
|
const [saveButtonHeight, setSaveButtonHeight] = useState(0);
|
|
72
75
|
const [messageBannerHeight, setMessageBannerHeight] = useState(0);
|
|
73
|
-
|
|
76
|
+
const { setIsScrolling } = useInputAccessoriesContext();
|
|
74
77
|
const {
|
|
75
78
|
formMethods,
|
|
76
79
|
handleSubmit,
|
|
@@ -178,12 +181,12 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
178
181
|
contentContainerStyle={
|
|
179
182
|
!keyboardHeight && styles.scrollContentContainer
|
|
180
183
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
onScrollBeginDrag={() => {
|
|
185
|
+
setIsScrolling(true);
|
|
186
|
+
}}
|
|
187
|
+
onScrollEndDrag={() => {
|
|
188
|
+
setIsScrolling(false);
|
|
189
|
+
}}
|
|
187
190
|
>
|
|
188
191
|
<View
|
|
189
192
|
onLayout={({ nativeEvent }) => {
|
|
@@ -29,7 +29,7 @@ import type {
|
|
|
29
29
|
} from "../InputFieldWrapper/InputFieldWrapper";
|
|
30
30
|
import { InputFieldWrapper } from "../InputFieldWrapper";
|
|
31
31
|
import { useCommonInputStyles } from "../InputFieldWrapper/CommonInputStyles.style";
|
|
32
|
-
import { useScreenInformation } from "../Form/hooks/useScreenInformation";
|
|
32
|
+
// import { useScreenInformation } from "../Form/hooks/useScreenInformation";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Buffer zone in pixels for offscreen detection.
|
|
@@ -37,7 +37,7 @@ import { useScreenInformation } from "../Form/hooks/useScreenInformation";
|
|
|
37
37
|
* even if it's technically still visible but within this buffer distance from the edge.
|
|
38
38
|
*/
|
|
39
39
|
// 44 (accessory bar height) + 20 (buffer)
|
|
40
|
-
const KEYBOARD_AWARE_DETECTION_BUFFER = 64;
|
|
40
|
+
// const KEYBOARD_AWARE_DETECTION_BUFFER = 64;
|
|
41
41
|
|
|
42
42
|
export interface InputTextProps
|
|
43
43
|
extends Pick<
|
|
@@ -341,6 +341,7 @@ function InputTextInternal(
|
|
|
341
341
|
unregister,
|
|
342
342
|
setFocusedInput,
|
|
343
343
|
canFocusNext,
|
|
344
|
+
isScrolling,
|
|
344
345
|
onFocusNext,
|
|
345
346
|
} = useInputAccessoriesContext();
|
|
346
347
|
useEffect(() => {
|
|
@@ -442,8 +443,8 @@ function InputTextInternal(
|
|
|
442
443
|
]}
|
|
443
444
|
// Prevent focus during scroll for multiline inputs to avoid
|
|
444
445
|
// the input focusing when the user is trying to scroll the form
|
|
445
|
-
|
|
446
|
-
readOnly={readonly}
|
|
446
|
+
readOnly={readonly || (multiline && isScrolling && !focused)}
|
|
447
|
+
// readOnly={readonly}
|
|
447
448
|
editable={!disabled}
|
|
448
449
|
keyboardType={keyboard}
|
|
449
450
|
value={inputTransform(internalValue)}
|