@jobber/components-native 0.88.0 → 0.88.1-JOB-139048-04134dd.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 +2 -2
- package/dist/src/ContentOverlay/ContentOverlay.js +2 -2
- package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +27 -0
- package/dist/src/ContentOverlay/index.js +1 -0
- package/dist/src/utils/meta/meta.json +2 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
- package/dist/types/src/ContentOverlay/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/ContentOverlay/ContentOverlay.test.tsx +30 -23
- package/src/ContentOverlay/ContentOverlay.tsx +4 -3
- package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +45 -0
- package/src/ContentOverlay/index.ts +1 -0
- package/src/utils/meta/meta.json +2 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.88.0",
|
|
3
|
+
"version": "0.88.1-JOB-139048-04134dd.0+04134dd81",
|
|
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": "
|
|
97
|
+
"gitHead": "04134dd81a80801cb9749c94d92f80b0e1d7c7dc"
|
|
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(
|
|
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,27 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState, } from "react";
|
|
2
|
+
import { Modalize } from "react-native-modalize";
|
|
3
|
+
// DON'T USE THIS COMPONENT DIRECTLY.
|
|
4
|
+
// It is exposed only so that the deprecated ContentOverlay component can use this along with the
|
|
5
|
+
// newer one contained in this lib.
|
|
6
|
+
// This is a temporary solution for new architecture. JOB-137549 plans to replace modalize entirely.
|
|
7
|
+
export const UNSAFE_WrappedModalize = forwardRef((props, ref) => {
|
|
8
|
+
const innerRef = useRef(null);
|
|
9
|
+
const [openRenderId, setOpenRenderId] = useState(0);
|
|
10
|
+
useImperativeHandle(ref, () => ({
|
|
11
|
+
open(dest) {
|
|
12
|
+
setOpenRenderId(id => id + 1);
|
|
13
|
+
// Open on a fresh tick for additional safety
|
|
14
|
+
requestAnimationFrame(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.open(dest);
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
close(dest) {
|
|
20
|
+
var _a;
|
|
21
|
+
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.close(dest);
|
|
22
|
+
},
|
|
23
|
+
}), []);
|
|
24
|
+
// Use a unique key to force a remount, ensuring we get fresh gesture handler nodes within modalize
|
|
25
|
+
return (React.createElement(Modalize, Object.assign({ key: `modalize-${openRenderId}`, ref: innerRef }, props)));
|
|
26
|
+
});
|
|
27
|
+
UNSAFE_WrappedModalize.displayName = "UNSAFE_WrappedModalize";
|