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

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.89.0",
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": "11776ee31e17536a81a51c143933031f0601a270"
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";