@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 +2 -2
- package/dist/src/Form/Form.js +9 -10
- package/dist/src/InputText/InputText.js +35 -20
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Form/Form.tsx +15 -14
- package/src/InputText/InputText.tsx +19 -21
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-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": "
|
|
99
|
+
"gitHead": "80fe04c86fc91e07591231460c32bc3194072bdc"
|
|
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";
|
|
@@ -26,10 +26,7 @@ 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 {
|
|
30
|
-
InputAccessoriesProvider,
|
|
31
|
-
useInputAccessoriesContext,
|
|
32
|
-
} from "../InputText";
|
|
29
|
+
import { InputAccessoriesProvider } from "../InputText";
|
|
33
30
|
import { tokens } from "../utils/design";
|
|
34
31
|
import { ErrorMessageProvider } from "../ErrorMessageWrapper";
|
|
35
32
|
|
|
@@ -73,7 +70,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
73
70
|
const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
|
|
74
71
|
const [saveButtonHeight, setSaveButtonHeight] = useState(0);
|
|
75
72
|
const [messageBannerHeight, setMessageBannerHeight] = useState(0);
|
|
76
|
-
const { setIsScrolling } = useInputAccessoriesContext();
|
|
73
|
+
// const { setIsScrolling } = useInputAccessoriesContext();
|
|
77
74
|
const {
|
|
78
75
|
formMethods,
|
|
79
76
|
handleSubmit,
|
|
@@ -111,8 +108,12 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
111
108
|
const [isSecondaryActionLoading, setIsSecondaryActionLoading] =
|
|
112
109
|
useState<boolean>(false);
|
|
113
110
|
|
|
114
|
-
const
|
|
115
|
-
|
|
111
|
+
const { calculatedKeyboardHeight } = useMemo(() => {
|
|
112
|
+
return {
|
|
113
|
+
calculatedKeyboardHeight:
|
|
114
|
+
keyboardHeight - (paddingBottom + KEYBOARD_SAVE_BUTTON_DISTANCE),
|
|
115
|
+
};
|
|
116
|
+
}, [paddingBottom, keyboardHeight]);
|
|
116
117
|
|
|
117
118
|
useScrollToError({
|
|
118
119
|
formState: formMethods.formState,
|
|
@@ -177,12 +178,12 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
177
178
|
contentContainerStyle={
|
|
178
179
|
!keyboardHeight && styles.scrollContentContainer
|
|
179
180
|
}
|
|
180
|
-
onScrollBeginDrag={() => {
|
|
181
|
-
|
|
182
|
-
}}
|
|
183
|
-
onScrollEndDrag={() => {
|
|
184
|
-
|
|
185
|
-
}}
|
|
181
|
+
// onScrollBeginDrag={() => {
|
|
182
|
+
// setIsScrolling(true);
|
|
183
|
+
// }}
|
|
184
|
+
// onScrollEndDrag={() => {
|
|
185
|
+
// setIsScrolling(false);
|
|
186
|
+
// }}
|
|
186
187
|
>
|
|
187
188
|
<View
|
|
188
189
|
onLayout={({ nativeEvent }) => {
|
|
@@ -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,
|
|
@@ -343,7 +342,6 @@ function InputTextInternal(
|
|
|
343
342
|
setFocusedInput,
|
|
344
343
|
canFocusNext,
|
|
345
344
|
onFocusNext,
|
|
346
|
-
isScrolling,
|
|
347
345
|
} = useInputAccessoriesContext();
|
|
348
346
|
useEffect(() => {
|
|
349
347
|
_name &&
|
|
@@ -383,10 +381,10 @@ function InputTextInternal(
|
|
|
383
381
|
|
|
384
382
|
const styles = useStyles();
|
|
385
383
|
const commonInputStyles = useCommonInputStyles();
|
|
386
|
-
const { headerHeight, windowHeight } = useScreenInformation();
|
|
384
|
+
// const { headerHeight, windowHeight } = useScreenInformation();
|
|
387
385
|
// State to track if the InputText component can fully fit on screen
|
|
388
386
|
// (i.e., it's completely visible). Use this state to handle visibility issues.
|
|
389
|
-
const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
|
|
387
|
+
// const [canFullyFitOnScreen, setCanFullyFitOnScreen] = useState(true);
|
|
390
388
|
|
|
391
389
|
return (
|
|
392
390
|
<InputFieldWrapper
|
|
@@ -409,20 +407,20 @@ function InputTextInternal(
|
|
|
409
407
|
loadingType={loadingType}
|
|
410
408
|
>
|
|
411
409
|
<TextInput
|
|
412
|
-
onLayout={(event: LayoutChangeEvent) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}}
|
|
410
|
+
// onLayout={(event: LayoutChangeEvent) => {
|
|
411
|
+
// event.target?.measureInWindow((_, y, __, height) => {
|
|
412
|
+
// // Check if component can't fully fit on screen (height only)
|
|
413
|
+
// // Account for headerHeight at the top of the screen and buffer zone
|
|
414
|
+
// const visibleTop = headerHeight + KEYBOARD_AWARE_DETECTION_BUFFER; // Top of visible area (below header) with buffer
|
|
415
|
+
// const visibleBottom =
|
|
416
|
+
// windowHeight - KEYBOARD_AWARE_DETECTION_BUFFER; // Bottom of visible area with buffer
|
|
417
|
+
// const isOffScreen =
|
|
418
|
+
// y < visibleTop || // Top edge is behind or above the header (with buffer)
|
|
419
|
+
// y + height > visibleBottom; // Bottom edge is below the window (with buffer)
|
|
420
|
+
|
|
421
|
+
// setCanFullyFitOnScreen(!isOffScreen);
|
|
422
|
+
// });
|
|
423
|
+
// }}
|
|
426
424
|
inputAccessoryViewID={inputAccessoryID || undefined}
|
|
427
425
|
testID={testID}
|
|
428
426
|
autoCapitalize={autoCapitalize}
|
|
@@ -444,8 +442,8 @@ function InputTextInternal(
|
|
|
444
442
|
]}
|
|
445
443
|
// Prevent focus during scroll for multiline inputs to avoid
|
|
446
444
|
// the input focusing when the user is trying to scroll the form
|
|
447
|
-
readOnly={readonly || (multiline && isScrolling && !focused)}
|
|
448
|
-
|
|
445
|
+
// readOnly={readonly || (multiline && isScrolling && !focused)}
|
|
446
|
+
readOnly={readonly}
|
|
449
447
|
editable={!disabled}
|
|
450
448
|
keyboardType={keyboard}
|
|
451
449
|
value={inputTransform(internalValue)}
|
|
@@ -456,7 +454,7 @@ function InputTextInternal(
|
|
|
456
454
|
// State for tracking if the input should be scrollable.
|
|
457
455
|
// This is tech debt related to an issue where keyboard aware scrollview doesn't work if `scrollEnabled` is true. However,
|
|
458
456
|
// 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"
|
|
457
|
+
scrollEnabled={Platform.OS === "ios"}
|
|
460
458
|
textContentType={textContentType}
|
|
461
459
|
onChangeText={handleChangeText}
|
|
462
460
|
onSubmitEditing={handleOnSubmitEditing}
|