rampkit-expo-dev 0.0.16 → 0.0.17
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/build/RampkitOverlay.js +19 -4
- package/package.json +1 -1
package/build/RampkitOverlay.js
CHANGED
|
@@ -351,13 +351,28 @@ function Overlay(props) {
|
|
|
351
351
|
};
|
|
352
352
|
}, [handleRequestClose, props.onRegisterClose]);
|
|
353
353
|
// Android hardware back goes to previous page, then closes
|
|
354
|
-
const navigateToIndex = (nextIndex) => {
|
|
354
|
+
const navigateToIndex = (nextIndex, animation = "fade") => {
|
|
355
355
|
if (nextIndex === index ||
|
|
356
356
|
nextIndex < 0 ||
|
|
357
357
|
nextIndex >= props.screens.length)
|
|
358
358
|
return;
|
|
359
359
|
if (isTransitioning)
|
|
360
360
|
return;
|
|
361
|
+
// Slide animation: use PagerView's built-in animated page change
|
|
362
|
+
// and skip the fade curtain overlay.
|
|
363
|
+
if (animation === "slide") {
|
|
364
|
+
// @ts-ignore: methods exist on PagerView instance
|
|
365
|
+
const pager = pagerRef.current;
|
|
366
|
+
if (!pager)
|
|
367
|
+
return;
|
|
368
|
+
if (typeof pager.setPage === "function") {
|
|
369
|
+
pager.setPage(nextIndex);
|
|
370
|
+
}
|
|
371
|
+
else if (typeof pager.setPageWithoutAnimation === "function") {
|
|
372
|
+
pager.setPageWithoutAnimation(nextIndex);
|
|
373
|
+
}
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
361
376
|
setIsTransitioning(true);
|
|
362
377
|
react_native_1.Animated.timing(fadeOpacity, {
|
|
363
378
|
toValue: 1,
|
|
@@ -674,7 +689,7 @@ function Overlay(props) {
|
|
|
674
689
|
const target = data === null || data === void 0 ? void 0 : data.targetScreenId;
|
|
675
690
|
if (target === "__goBack__") {
|
|
676
691
|
if (i > 0) {
|
|
677
|
-
navigateToIndex(i - 1);
|
|
692
|
+
navigateToIndex(i - 1, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
678
693
|
}
|
|
679
694
|
else {
|
|
680
695
|
handleRequestClose();
|
|
@@ -687,7 +702,7 @@ function Overlay(props) {
|
|
|
687
702
|
}
|
|
688
703
|
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
689
704
|
if (targetIndex >= 0) {
|
|
690
|
-
navigateToIndex(targetIndex);
|
|
705
|
+
navigateToIndex(targetIndex, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
691
706
|
}
|
|
692
707
|
else {
|
|
693
708
|
handleAdvance(i);
|
|
@@ -696,7 +711,7 @@ function Overlay(props) {
|
|
|
696
711
|
}
|
|
697
712
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:goBack") {
|
|
698
713
|
if (i > 0) {
|
|
699
|
-
navigateToIndex(i - 1);
|
|
714
|
+
navigateToIndex(i - 1, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
700
715
|
}
|
|
701
716
|
else {
|
|
702
717
|
handleRequestClose();
|
package/package.json
CHANGED