fix: updated modal unmounting handling (#327)

* chore: updated dependencies

* refactor: updated bottom sheet modal handling
This commit is contained in:
Mo Gorhom
2021-03-13 21:39:02 +00:00
committed by GitHub
parent 2c7b763144
commit a5628161c5
8 changed files with 353 additions and 274 deletions

View File

@@ -304,11 +304,11 @@ PODS:
- React-jsi (= 0.63.4)
- RNCMaskedView (0.1.10):
- React
- RNGestureHandler (1.10.1):
- RNGestureHandler (1.10.3):
- React-Core
- RNReanimated (1.13.2):
- React-Core
- RNScreens (2.15.0):
- RNScreens (2.18.1):
- React-Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
@@ -494,9 +494,9 @@ SPEC CHECKSUMS:
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNGestureHandler: 5e58135436aacc1c5d29b75547d3d2b9430d052c
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
RNReanimated: e03f7425cb7a38dcf1b644d680d1bfc91c3337ad
RNScreens: 2ad555d4d9fa10b91bb765ca07fe9b29d59573f0
RNScreens: f7ad633b2e0190b77b6a7aab7f914fad6f198d8d
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

View File

@@ -9,22 +9,22 @@
"start": "react-native start"
},
"dependencies": {
"@gorhom/portal": "^0.2.0",
"@gorhom/portal": "^1.0.4",
"@gorhom/showcase-template": "^1.0.2",
"@react-native-community/blur": "^3.6.0",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/native": "^5.8.10",
"@react-navigation/stack": "^5.12.8",
"@react-navigation/native": "^5.9.3",
"@react-navigation/stack": "^5.14.3",
"faker": "^4.1.0",
"lodash.isequal": "^4.5.0",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-gesture-handler": "^1.10.1",
"react-native-gesture-handler": "^1.10.3",
"react-native-maps": "^0.27.1",
"react-native-reanimated": "^1.13.2",
"react-native-redash": "^14.2.4",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.15.0"
"react-native-screens": "^2.18.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
@@ -34,6 +34,6 @@
"@types/react-native": "^0.63.37",
"metro-react-native-babel-preset": "^0.64.0",
"nanoid": "^3.1.20",
"typescript": "^4.1.2"
"typescript": "^4.2.3"
}
}

View File

@@ -818,11 +818,12 @@
dependencies:
"@types/hammerjs" "^2.0.36"
"@gorhom/portal@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-0.2.0.tgz#65423726b1352e2b9e3c3b8da83a58e4dff48ce6"
integrity sha512-PoYYSliPCl624ORih+zyI1pVbH2Y2Mj+EY6nXeAIi2r1LGv10hItZLzdgnbPPfQ0neikTDYArlOzuB5zKIex5w==
"@gorhom/portal@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-1.0.4.tgz#643c7baaffee223819cdd99dad748c3d9dc6bd73"
integrity sha512-KalM9E6Op1TCzi00YKhczBz86EV0yYpWuRuTt5J4VS09O2gGbGAEEJwUKb/Rvr3XadtinpLjePj0tZ6lFVPp+g==
dependencies:
immer "^8.0.1"
lodash.isequal "^4.5.0"
nanoid "^3.1.20"
@@ -1050,37 +1051,37 @@
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.10.tgz#5dda643e19e587793bc2034dd9bf7398ad43d401"
integrity sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==
"@react-navigation/core@^5.14.4":
version "5.14.4"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.14.4.tgz#f63a2cd214bddbd25e1181f9335c32dfc3b6460f"
integrity sha512-MzZU9PO1a/6f9KdN04dC/E4BNl6M1Ba0Tb4sQdl/32y0hM2ToxlrKcERnTLWGFIbQV+9ZV1GTrp3mlGS6U9Jpw==
"@react-navigation/core@^5.15.2":
version "5.15.2"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.15.2.tgz#6aa374c7bcb6ffcaac8e2a7f8bdb2f9aba469b31"
integrity sha512-jNSP0FMu1N6Pa1Slsy8b/JbmlTAXcVeXVwnxrEMVGWeiNqUVYl+tx1FuQAqi3q1m4cg9ygXkGsgLgRmnXAEC8g==
dependencies:
"@react-navigation/routers" "^5.6.2"
"@react-navigation/routers" "^5.7.2"
escape-string-regexp "^4.0.0"
nanoid "^3.1.15"
query-string "^6.13.6"
react-is "^16.13.0"
"@react-navigation/native@^5.8.10":
version "5.8.10"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.8.10.tgz#3fe806abff9efb085bcf595212803dd05a1347ca"
integrity sha512-OUgD1o+y7PwmhRIRqQxN0SQvVU/SHic/ek/qMvBZX8nu5/WlBNxmNRMHVxONgHlG3AQZh27NUs9ynntL7ek1zQ==
"@react-navigation/native@^5.9.3":
version "5.9.3"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.9.3.tgz#3859f439adc9a744b79a98fbc7606bdd459574d5"
integrity sha512-xaRlCDRVuFGxHsP/IetwLdNvLJwIJBYCUIx/ufWs6QkT9Q0EB0DtKzXCItuHydjMEVPd1Cy7lfjUlSM6hZ6Q3Q==
dependencies:
"@react-navigation/core" "^5.14.4"
"@react-navigation/core" "^5.15.2"
escape-string-regexp "^4.0.0"
nanoid "^3.1.15"
"@react-navigation/routers@^5.6.2":
version "5.6.2"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.6.2.tgz#accc008c3b777f74d998e16cb2ea8e4c1fe8d9aa"
integrity sha512-XBcDKXS5s4MaHFufN44LtbXqFDH/nUHfHjbwG85fP3k772oRyPRgbnUb2mbw5MFGqORla9T7uymR6Gh6uwIwVw==
"@react-navigation/routers@^5.7.2":
version "5.7.2"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.7.2.tgz#069d0a707b30ba2e27a32b6482531d0ff7317136"
integrity sha512-BxNSMLHpU+oS37Xok0ql6rc9U7IC8aUD4+U5ZPbjDJ0pwzZxGGh0YOEBzfV4k/Ig3cbPdvVWbc1C9HHbCVr2oQ==
dependencies:
nanoid "^3.1.15"
"@react-navigation/stack@^5.12.8":
version "5.12.8"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.12.8.tgz#31e54e05d8a3ffaaa3e39a1a9b7969f8316a35bf"
integrity sha512-wUJFbU0v606RBXOUxHToCXJNmiwxtFYhN2TFvjxCZ3PJU+OWWx8HTmn99pT3rVH4Ax2cfO5BDUy9v+r74ZrIWw==
"@react-navigation/stack@^5.14.3":
version "5.14.3"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.14.3.tgz#3d15fcd2cf8d0d2a1248686565c6a85e2d8e1c55"
integrity sha512-7rHc13DHsYP7l7GcgBcLEyX2/IAuCcRZ1Iu3MtOZSayjvFXxBBYKFKw0OyY9NxOfZUdLl3Q3mLiUHVFZkHMcuA==
dependencies:
color "^3.1.3"
react-native-iphone-x-helper "^1.3.0"
@@ -1100,11 +1101,6 @@
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.36.tgz#17ce0a235e9ffbcdcdf5095646b374c2bf615a4c"
integrity sha512-7TUK/k2/QGpEAv/BCwSHlYu3NXZhQ9ZwBYpzr9tjlPIL2C5BeGhH3DmVavRx3ZNyELX5TLC91JTz/cen6AAtIQ==
"@types/hammerjs@^2.0.38":
version "2.0.38"
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.38.tgz#44fdab66fb960fc7002f4a9e54d91545f0bf9448"
integrity sha512-wuwDzWW1JWh3BZoRftBlKcctjNzR75QFY4/b4zAz7sH1EesA8HBJzke+bF5dxCATNdHHs3X1P5UWanbbUT6chw==
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762"
@@ -2410,6 +2406,11 @@ image-size@^0.6.0:
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2"
integrity sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA==
immer@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656"
integrity sha512-aqXhGP7//Gui2+UrEtvxZxSquQVXTpZ7KDxfCcKAF3Vysvw0CViVaW9RZ1j1xlIYqaaaipBoqdqeibkc18PNvA==
import-fresh@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546"
@@ -3819,13 +3820,12 @@ react-is@^16.12.0, react-is@^16.13.0, react-is@^16.7.0, react-is@^16.8.1, react-
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
react-native-gesture-handler@^1.10.1:
version "1.10.1"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.10.1.tgz#e7a93a5bc516338bc24a57b3312043dc00489377"
integrity sha512-sDo6T0m+izIDczsIzE63nAqEG3BE/OwkCJoU4/qjdo7ryem7D0Rj/Y+SlAZP2lVAhllo65LDRYqd6SBe4y19Mg==
react-native-gesture-handler@^1.10.3:
version "1.10.3"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.10.3.tgz#942bbf2963bbf49fa79593600ee9d7b5dab3cfc0"
integrity sha512-cBGMi1IEsIVMgoox4RvMx7V2r6bNKw0uR1Mu1o7NbuHS6BRSVLq0dP34l2ecnPlC+jpWd3le6Yg1nrdCjby2Mw==
dependencies:
"@egjs/hammerjs" "^2.0.17"
"@types/hammerjs" "^2.0.38"
fbjs "^3.0.0"
hoist-non-react-statics "^3.3.0"
invariant "^2.2.4"
@@ -3862,10 +3862,10 @@ react-native-safe-area-context@^3.1.9:
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.1.9.tgz#48864ea976b0fa57142a2cc523e1fd3314e7247e"
integrity sha512-wmcGbdyE/vBSL5IjDPReoJUEqxkZsywZw5gPwsVUV1NBpw5eTIdnL6Y0uNKHE25Z661moxPHQz6kwAkYQyorxA==
react-native-screens@^2.15.0:
version "2.15.0"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.15.0.tgz#9b97c1881c4fcdf304bf363f0013225901625f44"
integrity sha512-qTSQPy0WKHtlb8xt5gY0Gt6sdvfQUQAnFSqgsggW9UEvySbkHzpqOrOYNA79Ca8oXO0dCFwp6X8buIiDefa7+Q==
react-native-screens@^2.18.1:
version "2.18.1"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.18.1.tgz#47b9991c6f762d00d0ed3233e5283d523e859885"
integrity sha512-r5WZLpmx2hHjC1RgMdPq5YpSU9tEhBpUaZ5M1SUtNIONyiLqQVxabhRCINdebIk4depJiIl7yw2Q85zJyeX6fw==
react-native@0.63.4:
version "0.63.4"
@@ -4569,10 +4569,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==
typescript@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
ua-parser-js@^0.7.18:
version "0.7.21"

View File

@@ -37,7 +37,7 @@
"bootstrap": "yarn install && yarn example"
},
"dependencies": {
"@gorhom/portal": "^0.2.0",
"@gorhom/portal": "^1.0.4",
"invariant": "^2.2.4",
"lodash.isequal": "^4.5.0",
"nanoid": "^3.1.20",
@@ -55,17 +55,17 @@
"@types/react-native": "0.61.10",
"auto-changelog": "^2.2.1",
"copyfiles": "^2.4.1",
"eslint": "^7.15.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.2.0",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.3.4",
"prettier": "^2.2.1",
"react": "~16.9.0",
"react-native": "^0.62.2",
"react-native-gesture-handler": "^1.9.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^1.13.2",
"release-it": "^14.2.2",
"typescript": "^4.1.2"
"typescript": "^4.2.3"
},
"peerDependencies": {
"react": "*",

View File

@@ -45,21 +45,22 @@ const BottomSheetModalComponent = forwardRef<
//#endregion
//#region hooks
const { unmount: unmountPortal } = usePortal();
const {
containerHeight,
mountSheet,
unmountSheet,
willUnmountSheet,
} = useBottomSheetModalInternal();
const { removePortal: unmountPortal } = usePortal();
//#endregion
//#region refs
const bottomSheetRef = useRef<BottomSheet>(null);
const isMinimized = useRef(false);
const isForcedDismissed = useRef(false);
const currentIndexRef = useRef(-1);
const nextIndexRef = useRef(-1);
const restoreIndexRef = useRef(-1);
const minimized = useRef(false);
const forcedDismissed = useRef(false);
const mounted = useRef(true);
//#endregion
//#region variables
@@ -79,132 +80,172 @@ const BottomSheetModalComponent = forwardRef<
);
//#endregion
//#region callbacks
const doDismiss = useCallback(() => {
// reset
isMinimized.current = false;
isForcedDismissed.current = false;
//#region private methods
const resetVariables = useCallback(() => {
currentIndexRef.current = -1;
nextIndexRef.current = -1;
restoreIndexRef.current = -1;
minimized.current = false;
mounted.current = true;
forcedDismissed.current = false;
}, []);
const adjustIndex = useCallback(
(_index: number) => (dismissOnPanDown ? _index - 1 : _index),
[dismissOnPanDown]
);
const unmount = useCallback(() => {
const _mounted = mounted.current;
// unmount the sheet and the portal
// reset variables
resetVariables();
// unmount sheet and portal
unmountSheet(key);
unmountPortal(key);
setMount(false);
// fire the call back
// unmount the node, if sheet is still mounted
if (_mounted) {
setMount(false);
}
// fire `onDismiss` callback
if (_providedOnDismiss) {
_providedOnDismiss();
}
}, [key, _providedOnDismiss, unmountSheet, unmountPortal]);
const handleOnChange = useCallback(
(_index: number) => {
if (isMinimized.current && !isForcedDismissed.current) {
}, [key, resetVariables, unmountSheet, unmountPortal, _providedOnDismiss]);
//#endregion
//#region bottom sheet methods
const handleSnapTo = useCallback(() => {
if (minimized.current) {
return;
}
const adjustedIndex = dismissOnPanDown ? _index - 1 : _index;
currentIndexRef.current = _index;
nextIndexRef.current = _index;
if (adjustedIndex >= 0) {
if (_providedOnChange) {
_providedOnChange(adjustedIndex);
bottomSheetRef.current?.snapTo(adjustIndex(currentIndexRef.current));
}, [adjustIndex]);
const handleExpand = useCallback(() => {
if (minimized.current) {
return;
}
bottomSheetRef.current?.expand();
}, []);
const handleCollapse = useCallback(() => {
if (minimized.current) {
return;
}
if (dismissOnPanDown) {
bottomSheetRef.current?.snapTo(1);
} else {
doDismiss();
bottomSheetRef.current?.collapse();
}
},
[dismissOnPanDown, _providedOnChange, doDismiss]
);
}, [dismissOnPanDown]);
const handleClose = useCallback(() => {
if (minimized.current) {
return;
}
bottomSheetRef.current?.close();
}, []);
//#endregion
//#region public methods
//#region bottom sheet modal methods
const handlePresent = useCallback(() => {
requestAnimationFrame(() => {
nextIndexRef.current = index;
setMount(true);
mountSheet(key, ref);
});
}, [key, mountSheet, ref, index]);
const handleDismiss = useCallback(
(force: boolean = false) => {
if (force) {
if (isMinimized.current) {
doDismiss();
}, [key, ref, mountSheet]);
const handleDismiss = useCallback(() => {
/**
* if modal is already been dismiss, we exit the method.
*/
if (currentIndexRef.current === -1 && minimized.current === false) {
return;
}
if (minimized.current) {
unmount();
return;
}
isForcedDismissed.current = true;
isMinimized.current = false;
} else {
willUnmountSheet(key);
}
nextIndexRef.current = -1;
forcedDismissed.current = true;
bottomSheetRef.current?.close();
},
[key, doDismiss, willUnmountSheet]
);
const handleClose = useCallback(() => {
if (isMinimized.current) {
}, [willUnmountSheet, unmount, key]);
const handleMinimize = useCallback(() => {
if (minimized.current) {
return;
}
nextIndexRef.current = -1;
minimized.current = true;
/**
* if modal got minimized before it finish its mounting
* animation, we set the `restoreIndexRef` to the
* provided index.
*/
if (currentIndexRef.current === -1) {
restoreIndexRef.current = index;
} else {
restoreIndexRef.current = currentIndexRef.current;
}
bottomSheetRef.current?.close();
}, [index]);
const handleRestore = useCallback(() => {
if (!minimized.current || forcedDismissed.current) {
return;
}
minimized.current = false;
bottomSheetRef.current?.snapTo(restoreIndexRef.current);
}, []);
const handleCollapse = useCallback(() => {
if (isMinimized.current) {
return;
}
nextIndexRef.current = dismissOnPanDown ? 1 : 0;
bottomSheetRef.current?.snapTo(nextIndexRef.current);
}, [dismissOnPanDown]);
const handleExpand = useCallback(() => {
if (isMinimized.current) {
return;
}
nextIndexRef.current = snapPoints.length - 1;
bottomSheetRef.current?.expand();
}, [snapPoints]);
const handleSnapTo = useCallback(
(_index: number) => {
if (isMinimized.current) {
return;
}
nextIndexRef.current = _index + (dismissOnPanDown ? 1 : 0);
bottomSheetRef.current?.snapTo(nextIndexRef.current);
},
[dismissOnPanDown]
);
//#endregion
//#region private methods
const handleMinimize = useCallback(() => {
if (!isMinimized.current) {
isMinimized.current = true;
//#region callbacks
const handlePortalOnUnmount = useCallback(() => {
/**
* if modal is already been dismiss, we exit the method.
*/
if (currentIndexRef.current === -1 && minimized.current === false) {
return;
}
mounted.current = false;
forcedDismissed.current = true;
if (minimized.current) {
unmount();
return;
}
willUnmountSheet(key);
bottomSheetRef.current?.close();
}, [key, unmount, willUnmountSheet]);
const handleBottomSheetOnChange = useCallback(
(_index: number) => {
const adjustedIndex = adjustIndex(_index);
currentIndexRef.current = _index;
if (_providedOnChange) {
_providedOnChange(adjustedIndex);
}
}, []);
const handleRestore = useCallback(() => {
if (isMinimized.current) {
isMinimized.current = false;
bottomSheetRef.current?.snapTo(nextIndexRef.current, true);
if (minimized.current) {
return;
}
}, []);
const handleOnUnmount = useCallback(() => {
if (currentIndexRef.current !== -1) {
handleDismiss(true);
if (adjustedIndex === -1) {
unmount();
}
}, [handleDismiss]);
},
[adjustIndex, unmount, _providedOnChange]
);
//#endregion
//#region expose public methods
useImperativeHandle(ref, () => ({
present: handlePresent,
dismiss: handleDismiss,
close: handleClose,
// sheet
snapTo: handleSnapTo,
expand: handleExpand,
collapse: handleCollapse,
close: handleClose,
// modal
present: handlePresent,
dismiss: handleDismiss,
// private
minimize: handleMinimize,
restore: handleRestore,
@@ -213,7 +254,7 @@ const BottomSheetModalComponent = forwardRef<
// render
return mount ? (
<Portal key={key} name={key} handleOnUnmount={handleOnUnmount}>
<Portal key={key} name={key} handleOnUnmount={handlePortalOnUnmount}>
<BottomSheet
{...bottomSheetProps}
ref={bottomSheetRef}
@@ -224,7 +265,7 @@ const BottomSheetModalComponent = forwardRef<
topInset={topInset}
bottomInset={bottomInset}
containerHeight={safeContainerHeight}
onChange={handleOnChange}
onChange={handleBottomSheetOnChange}
children={children}
/>
</Portal>

View File

@@ -7,7 +7,7 @@ export interface BottomSheetModalPrivateMethods {
}
export interface BottomSheetModalProps
extends Exclude<BottomSheetProps, 'animateOnMount' | 'containerHeight'> {
extends Omit<BottomSheetProps, 'animateOnMount' | 'containerHeight'> {
/**
* Modal name to help identify the modal for later on.
* @type string

View File

@@ -1,5 +1,5 @@
import React, { useCallback, useMemo, useRef, useState } from 'react';
import { PortalHost } from '@gorhom/portal';
import { PortalProvider } from '@gorhom/portal';
import {
BottomSheetModalProvider,
BottomSheetModalInternalProvider,
@@ -11,12 +11,9 @@ import type {
BottomSheetModalRef,
} from './types';
const BottomSheetModalProviderWrapper = (
props: BottomSheetModalProviderProps
) => {
// extract props
const { children } = props;
const BottomSheetModalProviderWrapper = ({
children,
}: BottomSheetModalProviderProps) => {
//#region layout state
const [containerHeight, setContainerHeight] = useState(WINDOW_HEIGHT);
//#endregion
@@ -33,94 +30,91 @@ const BottomSheetModalProviderWrapper = (
//#region private methods
const handleMountSheet = useCallback((key: string, ref) => {
const _sheetsQueue = sheetsQueueRef.current.slice();
const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);
const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;
/**
* Here we try to minimize the current sheet if exists,
* also we make sure that it is not incoming mounted sheet.
* Exit the method, if sheet is already presented
* and at the top.
*/
const mountedSheet =
sheetsQueueRef.current[sheetsQueueRef.current.length - 1];
if (mountedSheet && mountedSheet.key !== key && !mountedSheet.willUnmount) {
sheetsQueueRef.current[
sheetsQueueRef.current.length - 1
].ref.current.minimize();
if (sheetIndex !== -1 && sheetOnTop) {
return;
}
/**
* We check if the incoming sheet is already mounted.
* Minimize the current sheet if:
* - it exists.
* - it is not unmounting.
*/
const isIncomingSheetMounted =
sheetsQueueRef.current.find(item => item.key === key) !== undefined;
const currentMountedSheet = _sheetsQueue[_sheetsQueue.length - 1];
if (currentMountedSheet && !currentMountedSheet.willUnmount) {
currentMountedSheet.ref.current.minimize();
}
if (isIncomingSheetMounted) {
/**
* We move the mounted incoming sheet to the
* end of the queue.
* Restore and remove incoming sheet from the queue,
* if it was registered.
*/
const newSheetsQueue = sheetsQueueRef.current.filter(
item => item.key !== key
);
newSheetsQueue.push({
key,
ref,
willUnmount: false,
});
sheetsQueueRef.current = newSheetsQueue;
if (sheetIndex !== -1) {
_sheetsQueue.splice(sheetIndex, 1);
ref.current.restore();
} else {
/**
* We add the incoming sheet to the end of the queue.
*/
sheetsQueueRef.current.push({
}
_sheetsQueue.push({
key,
ref,
willUnmount: false,
});
}
sheetsQueueRef.current = _sheetsQueue;
}, []);
const handleUnmountSheet = useCallback((key: string) => {
const _sheetsQueue = sheetsQueueRef.current.slice();
const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);
const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;
/**
* Here we remove the unmounted sheet and update
* the sheets queue.
*/
const newSheetsQueue = sheetsQueueRef.current.filter(
item => item.key !== key
);
sheetsQueueRef.current = newSheetsQueue;
_sheetsQueue.splice(sheetIndex, 1);
sheetsQueueRef.current = _sheetsQueue;
/**
* Here we try to restore previous sheet position,
* This is needed when user dismiss the modal by panning down.
* Here we try to restore previous sheet position if unmounted
* sheet was on top. This is needed when user dismiss
* the modal by panning down.
*/
const hasMinimizedSheet = sheetsQueueRef.current.length > 0;
if (hasMinimizedSheet) {
if (sheetOnTop && hasMinimizedSheet) {
sheetsQueueRef.current[
sheetsQueueRef.current.length - 1
].ref.current.restore();
}
}, []);
const handleWillUnmountSheet = useCallback((key: string) => {
const _sheetsQueue = sheetsQueueRef.current.slice();
const sheetIndex = _sheetsQueue.findIndex(item => item.key === key);
const sheetOnTop = sheetIndex === _sheetsQueue.length - 1;
/**
* Here we mark the sheet that will unmount,
* so it won't be restored.
*/
const sheetToBeUnmount = sheetsQueueRef.current.find(
item => item.key === key
);
if (sheetToBeUnmount) {
sheetToBeUnmount.willUnmount = true;
if (sheetIndex !== -1) {
_sheetsQueue[sheetIndex].willUnmount = true;
}
/**
* Here we try to restore previous sheet position,
* This is needed when user dismiss the modal by fire the dismiss action.
*/
const hasMinimizedSheet = sheetsQueueRef.current.length > 1;
if (hasMinimizedSheet) {
sheetsQueueRef.current[
sheetsQueueRef.current.length - 2
].ref.current.restore();
const hasMinimizedSheet = _sheetsQueue.length > 1;
if (sheetOnTop && hasMinimizedSheet) {
_sheetsQueue[_sheetsQueue.length - 2].ref.current.restore();
}
sheetsQueueRef.current = _sheetsQueue;
}, []);
//#endregion
@@ -173,7 +167,7 @@ const BottomSheetModalProviderWrapper = (
onMeasureHeight={handleOnContainerMeasureHeight}
children={null}
/>
<PortalHost>{children}</PortalHost>
<PortalProvider>{children}</PortalProvider>
</BottomSheetModalInternalProvider>
</BottomSheetModalProvider>
);

154
yarn.lock
View File

@@ -2,6 +2,13 @@
# yarn lockfile v1
"@babel/code-frame@7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
dependencies:
"@babel/highlight" "^7.10.4"
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
@@ -1165,10 +1172,10 @@
dependencies:
"@types/hammerjs" "^2.0.36"
"@eslint/eslintrc@^0.2.2":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.2.tgz#d01fc791e2fc33e88a29d6f3dc7e93d0cd784b76"
integrity sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==
"@eslint/eslintrc@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547"
integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
@@ -1177,15 +1184,15 @@
ignore "^4.0.6"
import-fresh "^3.2.1"
js-yaml "^3.13.1"
lodash "^4.17.19"
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@gorhom/portal@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-0.2.0.tgz#65423726b1352e2b9e3c3b8da83a58e4dff48ce6"
integrity sha512-PoYYSliPCl624ORih+zyI1pVbH2Y2Mj+EY6nXeAIi2r1LGv10hItZLzdgnbPPfQ0neikTDYArlOzuB5zKIex5w==
"@gorhom/portal@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-1.0.4.tgz#643c7baaffee223819cdd99dad748c3d9dc6bd73"
integrity sha512-KalM9E6Op1TCzi00YKhczBz86EV0yYpWuRuTt5J4VS09O2gGbGAEEJwUKb/Rvr3XadtinpLjePj0tZ6lFVPp+g==
dependencies:
immer "^8.0.1"
lodash.isequal "^4.5.0"
nanoid "^3.1.20"
@@ -1885,7 +1892,7 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0"
indent-string "^4.0.0"
ajv@^6.10.0, ajv@^6.10.2:
ajv@^6.10.0:
version "6.12.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706"
integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==
@@ -1905,6 +1912,16 @@ ajv@^6.12.4:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ajv@^7.0.2:
version "7.1.1"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-7.1.1.tgz#1e6b37a454021fa9941713f38b952fc1c8d32a84"
integrity sha512-ga/aqDYnUy/o7vbsRTFhhTsNeXiYb5JWDIcRIeZfwRNCefwjNTVYCGdGSUrEmiu3yDK3vFvNbgJxvrQW4JXrYQ==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js "^4.2.2"
anser@^1.4.9:
version "1.4.10"
resolved "https://registry.yarnpkg.com/anser/-/anser-1.4.10.tgz#befa3eddf282684bd03b63dcda3927aef8c2e35b"
@@ -2132,6 +2149,11 @@ astral-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==
astral-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==
async-retry@1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.1.tgz#139f31f8ddce50c0870b0ba558a6079684aaed55"
@@ -3446,12 +3468,10 @@ eslint-config-prettier@^6.10.1:
dependencies:
get-stdin "^6.0.0"
eslint-config-prettier@^6.15.0:
version "6.15.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9"
integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==
dependencies:
get-stdin "^6.0.0"
eslint-config-prettier@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.1.0.tgz#4ef1eaf97afe5176e6a75ddfb57c335121abc5a6"
integrity sha512-oKMhGv3ihGbCIimCAjqkdzx2Q+jthoqnXSP+d86M9tptwugycmTFdVR4IpLgq2c4SHifbwO90z2fQ8/Aio73yw==
eslint-plugin-eslint-comments@^3.1.2:
version "3.2.0"
@@ -3480,10 +3500,10 @@ eslint-plugin-prettier@3.1.2:
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-plugin-prettier@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.2.0.tgz#af391b2226fa0e15c96f36c733f6e9035dbd952c"
integrity sha512-kOUSJnFjAUFKwVxuzy6sA5yyMx6+o9ino4gCdShzBNx4eyFRudWRYKCFolKjoM40PEiuU6Cn7wBLfq3WsGg7qg==
eslint-plugin-prettier@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"
integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==
dependencies:
prettier-linter-helpers "^1.0.0"
@@ -3561,13 +3581,13 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
eslint@^7.15.0:
version "7.15.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.15.0.tgz#eb155fb8ed0865fcf5d903f76be2e5b6cd7e0bc7"
integrity sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA==
eslint@^7.21.0:
version "7.21.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.21.0.tgz#4ecd5b8c5b44f5dedc9b8a110b01bbfeb15d1c83"
integrity sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==
dependencies:
"@babel/code-frame" "^7.0.0"
"@eslint/eslintrc" "^0.2.2"
"@babel/code-frame" "7.12.11"
"@eslint/eslintrc" "^0.4.0"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
@@ -3578,9 +3598,9 @@ eslint@^7.15.0:
eslint-utils "^2.1.0"
eslint-visitor-keys "^2.0.0"
espree "^7.3.1"
esquery "^1.2.0"
esquery "^1.4.0"
esutils "^2.0.2"
file-entry-cache "^6.0.0"
file-entry-cache "^6.0.1"
functional-red-black-tree "^1.0.1"
glob-parent "^5.0.0"
globals "^12.1.0"
@@ -3591,7 +3611,7 @@ eslint@^7.15.0:
js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
lodash "^4.17.19"
lodash "^4.17.20"
minimatch "^3.0.4"
natural-compare "^1.4.0"
optionator "^0.9.1"
@@ -3600,7 +3620,7 @@ eslint@^7.15.0:
semver "^7.2.1"
strip-ansi "^6.0.0"
strip-json-comments "^3.1.0"
table "^5.2.3"
table "^6.0.4"
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
@@ -3627,10 +3647,10 @@ esprima@^4.0.0:
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
esquery@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57"
integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==
esquery@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5"
integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==
dependencies:
estraverse "^5.1.0"
@@ -3950,10 +3970,10 @@ figures@^3.0.0:
dependencies:
escape-string-regexp "^1.0.5"
file-entry-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a"
integrity sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==
file-entry-cache@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==
dependencies:
flat-cache "^3.0.4"
@@ -4565,6 +4585,11 @@ image-size@^0.6.0:
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2"
integrity sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA==
immer@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656"
integrity sha512-aqXhGP7//Gui2+UrEtvxZxSquQVXTpZ7KDxfCcKAF3Vysvw0CViVaW9RZ1j1xlIYqaaaipBoqdqeibkc18PNvA==
import-cwd@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-3.0.0.tgz#20845547718015126ea9b3676b7592fb8bd4cf92"
@@ -5159,6 +5184,11 @@ json-schema-traverse@^0.4.1:
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
json-schema-traverse@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==
json-stable-stringify-without-jsonify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
@@ -6787,10 +6817,10 @@ react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
react-native-gesture-handler@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.9.0.tgz#e441b1c0277c3fd4ca3e5c58fdd681e2f0ceddf0"
integrity sha512-fkkNeWDBzDdwDxDcxtYbrb9T1g0PLgT1AxBs2iO/p7uEbDbC6mIoL/NzuOnKNEBHcd0lpLoJuNmIfdmucEON5g==
react-native-gesture-handler@^1.10.3:
version "1.10.3"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.10.3.tgz#942bbf2963bbf49fa79593600ee9d7b5dab3cfc0"
integrity sha512-cBGMi1IEsIVMgoox4RvMx7V2r6bNKw0uR1Mu1o7NbuHS6BRSVLq0dP34l2ecnPlC+jpWd3le6Yg1nrdCjby2Mw==
dependencies:
"@egjs/hammerjs" "^2.0.17"
fbjs "^3.0.0"
@@ -7125,6 +7155,11 @@ require-directory@^2.1.1:
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
require-from-string@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
require-main-filename@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
@@ -7500,7 +7535,7 @@ slash@^3.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
slice-ansi@^2.0.0, slice-ansi@^2.1.0:
slice-ansi@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636"
integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==
@@ -7509,6 +7544,15 @@ slice-ansi@^2.0.0, slice-ansi@^2.1.0:
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"
slice-ansi@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b"
integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==
dependencies:
ansi-styles "^4.0.0"
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"
slide@^1.1.5:
version "1.1.6"
resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707"
@@ -7841,15 +7885,15 @@ symbol-observable@1.0.1:
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
integrity sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=
table@^5.2.3:
version "5.4.6"
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==
table@^6.0.4:
version "6.0.7"
resolved "https://registry.yarnpkg.com/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34"
integrity sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==
dependencies:
ajv "^6.10.2"
lodash "^4.17.14"
slice-ansi "^2.1.0"
string-width "^3.0.0"
ajv "^7.0.2"
lodash "^4.17.20"
slice-ansi "^4.0.0"
string-width "^4.2.0"
temp-dir@^1.0.0:
version "1.0.0"
@@ -8056,10 +8100,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==
typescript@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
ua-parser-js@^0.7.18:
version "0.7.21"