@jobber/components-native 0.88.1-JOB-136074-020f532.3 → 0.88.1

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.88.1-JOB-136074-020f532.3+020f532a0",
3
+ "version": "0.88.1",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -94,5 +94,5 @@
94
94
  "react-native-safe-area-context": "^5.4.0",
95
95
  "react-native-svg": ">=12.0.0"
96
96
  },
97
- "gitHead": "020f532a06bc1651b24f6c7743a11dbd4e72553b"
97
+ "gitHead": "02b60328dca8a6166794f853db3219e7b3f9bca1"
98
98
  }
@@ -1,11 +1,11 @@
1
1
  import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState, } from "react";
2
- import { Modalize } from "react-native-modalize";
3
2
  import { useSafeAreaInsets } from "react-native-safe-area-context";
4
3
  import { AccessibilityInfo, Platform, View, findNodeHandle, useWindowDimensions, } from "react-native";
5
4
  import { Portal } from "react-native-portalize";
6
5
  import { useKeyboardVisibility } from "./hooks/useKeyboardVisibility";
7
6
  import { useStyles } from "./ContentOverlay.style";
8
7
  import { useViewLayoutHeight } from "./hooks/useViewLayoutHeight";
8
+ import { UNSAFE_WrappedModalize } from "./UNSAFE_WrappedModalize";
9
9
  import { useIsScreenReaderEnabled } from "../hooks";
10
10
  import { IconButton } from "../IconButton";
11
11
  import { Heading } from "../Heading";
@@ -86,7 +86,7 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
86
86
  }
87
87
  };
88
88
  return (React.createElement(React.Fragment, null,
89
- headerHeightKnown && childrenHeightKnown && (React.createElement(Modalize, { ref: callbackInternalRef, overlayStyle: styles.overlay, handleStyle: styles.handle, handlePosition: "inside", modalStyle: modalStyle, modalTopOffset: tokens["space-larger"], snapPoint: snapPoint, closeSnapPointStraightEnabled: false, withHandle: isDraggable, panGestureEnabled: isDraggable, adjustToContentHeight: adjustToContentHeight, disableScrollIfPossible: !adjustToContentHeight, onClose: onClose, onOpen: onOpen, keyboardAvoidingBehavior: keyboardAvoidingBehavior, avoidKeyboardLikeIOS: avoidKeyboardLikeIOS, childrenStyle: styles.childrenStyle, onBackButtonPress: onCloseController, closeOnOverlayTap: isCloseableOnOverlayTap, onOpened: () => {
89
+ headerHeightKnown && childrenHeightKnown && (React.createElement(UNSAFE_WrappedModalize, { ref: callbackInternalRef, overlayStyle: styles.overlay, handleStyle: styles.handle, handlePosition: "inside", modalStyle: modalStyle, modalTopOffset: tokens["space-larger"], snapPoint: snapPoint, closeSnapPointStraightEnabled: false, withHandle: isDraggable, panGestureEnabled: isDraggable, adjustToContentHeight: adjustToContentHeight, disableScrollIfPossible: !adjustToContentHeight, onClose: onClose, onOpen: onOpen, keyboardAvoidingBehavior: keyboardAvoidingBehavior, avoidKeyboardLikeIOS: avoidKeyboardLikeIOS, childrenStyle: styles.childrenStyle, onBackButtonPress: onCloseController, closeOnOverlayTap: isCloseableOnOverlayTap, onOpened: () => {
90
90
  if (overlayHeader.current) {
91
91
  const reactTag = findNodeHandle(overlayHeader.current);
92
92
  if (reactTag) {
@@ -0,0 +1,23 @@
1
+ import React, { forwardRef, useImperativeHandle, useRef, useState, } from "react";
2
+ import { Modalize } from "react-native-modalize";
3
+ export const UNSAFE_WrappedModalize = forwardRef((props, ref) => {
4
+ const innerRef = useRef(null);
5
+ const [openRenderId, setOpenRenderId] = useState(0);
6
+ useImperativeHandle(ref, () => ({
7
+ open(dest) {
8
+ setOpenRenderId(id => id + 1);
9
+ // Open on a fresh tick for additional safety
10
+ requestAnimationFrame(() => {
11
+ var _a;
12
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.open(dest);
13
+ });
14
+ },
15
+ close(dest) {
16
+ var _a;
17
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.close(dest);
18
+ },
19
+ }), []);
20
+ // Use a unique key to force a remount, ensuring we get fresh gesture handler nodes within modalize
21
+ return (React.createElement(Modalize, Object.assign({ key: `modalize-${openRenderId}`, ref: innerRef }, props)));
22
+ });
23
+ UNSAFE_WrappedModalize.displayName = "UNSAFE_WrappedModalize";
@@ -38,7 +38,6 @@ import { useScrollToError } from "./hooks/useScrollToError";
38
38
  import { FormSaveButton } from "./components/FormSaveButton";
39
39
  import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition";
40
40
  import { FormCache } from "./components/FormCache/FormCache";
41
- import { useAtlantisFormContext } from "./context/AtlantisFormContext";
42
41
  import { InputAccessoriesProvider } from "../InputText";
43
42
  import { tokens } from "../utils/design";
44
43
  import { ErrorMessageProvider } from "../ErrorMessageWrapper";
@@ -103,13 +102,12 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
103
102
  setMessageBannerHeight(event.nativeEvent.layout.height);
104
103
  };
105
104
  const styles = useStyles();
106
- const { edgeToEdgeEnabled } = useAtlantisFormContext();
107
105
  return (React.createElement(FormProvider, Object.assign({}, formMethods),
108
106
  React.createElement(React.Fragment, null,
109
107
  (isSubmitting || isSecondaryActionLoading) && React.createElement(FormMask, null),
110
108
  React.createElement(FormCache, { localCacheKey: localCacheKey, localCacheExclude: localCacheExclude, setLocalCache: setLocalCache }),
111
109
  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 },
112
- 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 }),
110
+ React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
113
111
  React.createElement(View, { onLayout: ({ nativeEvent }) => {
114
112
  setFormContentHeight(nativeEvent.layout.height);
115
113
  } },
@@ -8,7 +8,6 @@ export const atlantisFormContextDefaultValues = {
8
8
  setLocalCache: () => undefined,
9
9
  removeLocalCache: () => undefined,
10
10
  }),
11
- edgeToEdgeEnabled: false,
12
11
  };
13
12
  export const AtlantisFormContext = createContext(atlantisFormContextDefaultValues);
14
13
  export function useAtlantisFormContext() {