@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
package/dist/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/dist/src/Form/Form.js
CHANGED
|
@@ -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 } from "../InputText";
|
|
42
|
+
import { InputAccessoriesProvider, useInputAccessoriesContext, } 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
|
-
|
|
57
|
+
const { setIsScrolling } = useInputAccessoriesContext();
|
|
58
58
|
const { formMethods, handleSubmit, isSubmitting, removeListenerRef, setLocalCache, } = useInternalForm({
|
|
59
59
|
mode,
|
|
60
60
|
reValidateMode,
|
|
@@ -111,7 +111,11 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
|
|
|
111
111
|
(isSubmitting || isSecondaryActionLoading) && React.createElement(FormMask, null),
|
|
112
112
|
React.createElement(FormCache, { localCacheKey: localCacheKey, localCacheExclude: localCacheExclude, setLocalCache: setLocalCache }),
|
|
113
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 },
|
|
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
|
|
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, onScrollBeginDrag: () => {
|
|
115
|
+
setIsScrolling(true);
|
|
116
|
+
}, onScrollEndDrag: () => {
|
|
117
|
+
setIsScrolling(false);
|
|
118
|
+
} }),
|
|
115
119
|
React.createElement(View, { onLayout: ({ nativeEvent }) => {
|
|
116
120
|
setFormContentHeight(nativeEvent.layout.height);
|
|
117
121
|
} },
|
|
@@ -7,13 +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
|
-
/**
|
|
11
|
-
* Buffer zone in pixels for offscreen detection.
|
|
12
|
-
* This makes the detection more sensitive by marking the component as offscreen
|
|
13
|
-
* even if it's technically still visible but within this buffer distance from the edge.
|
|
14
|
-
*/
|
|
15
|
-
// 44 (accessory bar height) + 20 (buffer)
|
|
16
|
-
const KEYBOARD_AWARE_DETECTION_BUFFER = 64;
|
|
17
10
|
export const InputText = forwardRef(InputTextInternal);
|
|
18
11
|
// eslint-disable-next-line max-statements
|
|
19
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) {
|
|
@@ -47,7 +40,7 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
|
|
|
47
40
|
placeholderTextColor: "transparent",
|
|
48
41
|
}));
|
|
49
42
|
const _name = name !== null && name !== void 0 ? name : field.name;
|
|
50
|
-
const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, onFocusNext, } = useInputAccessoriesContext();
|
|
43
|
+
const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, isScrolling, onFocusNext, } = useInputAccessoriesContext();
|
|
51
44
|
useEffect(() => {
|
|
52
45
|
_name &&
|
|
53
46
|
register(_name, () => {
|
|
@@ -131,8 +124,9 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
|
|
|
131
124
|
],
|
|
132
125
|
// Prevent focus during scroll for multiline inputs to avoid
|
|
133
126
|
// the input focusing when the user is trying to scroll the form
|
|
134
|
-
|
|
135
|
-
readOnly
|
|
127
|
+
readOnly: readonly || (multiline && isScrolling && !focused),
|
|
128
|
+
// readOnly={readonly}
|
|
129
|
+
editable: !disabled, keyboardType: keyboard, value: inputTransform(internalValue), autoFocus: autoFocus, autoComplete: autoComplete, multiline: multiline,
|
|
136
130
|
// Makes sure it doesn't jump to the top of the screen when the keyboard is shown and a new line is added.
|
|
137
131
|
// State for tracking if the input should be scrollable.
|
|
138
132
|
// This is tech debt related to an issue where keyboard aware scrollview doesn't work if `scrollEnabled` is true. However,
|