@papyrus-sdk/ui-react-native 0.2.29 → 0.2.31
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/index.js +215 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +215 -97
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25939,12 +25939,17 @@ var shouldEnableViewerScrollForPageScrub = ({
|
|
|
25939
25939
|
isScrubbing
|
|
25940
25940
|
}) => viewerScrollEnabled && !isScrubbing;
|
|
25941
25941
|
var resolvePageScrubberTouchPolicy = () => ({
|
|
25942
|
-
responderTarget: "
|
|
25942
|
+
responderTarget: "track",
|
|
25943
25943
|
claimOnStart: true,
|
|
25944
25944
|
captureOnStart: true,
|
|
25945
25945
|
captureOnMove: true,
|
|
25946
25946
|
childConsumesTouch: false
|
|
25947
25947
|
});
|
|
25948
|
+
var resolvePageScrubberOverlayStyle = () => ({
|
|
25949
|
+
zIndex: 30,
|
|
25950
|
+
elevation: 30
|
|
25951
|
+
});
|
|
25952
|
+
var resolvePageScrubberPointerEvents = () => "box-only";
|
|
25948
25953
|
var resolvePageScrubberReleaseAction = ({
|
|
25949
25954
|
hasMoved,
|
|
25950
25955
|
pendingPage
|
|
@@ -25978,6 +25983,16 @@ var resolvePageScrubberThumbTopFromPosition = ({
|
|
|
25978
25983
|
trackHeight,
|
|
25979
25984
|
thumbHeight
|
|
25980
25985
|
}) => Math.max(0, Math.min(trackHeight - thumbHeight, position - thumbHeight / 2));
|
|
25986
|
+
var resolvePageScrubberTrackRevealOrigin = ({
|
|
25987
|
+
thumbTop,
|
|
25988
|
+
thumbHeight,
|
|
25989
|
+
trackHeight
|
|
25990
|
+
}) => Math.max(0, Math.min(trackHeight, thumbTop + thumbHeight / 2));
|
|
25991
|
+
var resolvePageScrubberTrackHeight = ({
|
|
25992
|
+
windowHeight,
|
|
25993
|
+
topOffset,
|
|
25994
|
+
bottomOffset
|
|
25995
|
+
}) => Math.max(180, Math.min(720, windowHeight - topOffset - bottomOffset - 56));
|
|
25981
25996
|
var resolvePageScrubberThumbTop = ({
|
|
25982
25997
|
currentPage,
|
|
25983
25998
|
trackHeight,
|
|
@@ -26008,6 +26023,23 @@ var resolvePageScrubberPage = ({
|
|
|
26008
26023
|
Math.min(pageCount, Math.round(ratio * (pageCount - 1)) + 1)
|
|
26009
26024
|
);
|
|
26010
26025
|
};
|
|
26026
|
+
var isPageScrubberTrackYTrusted = (trackY, windowHeight) => Number.isFinite(trackY) && Number.isFinite(windowHeight) && trackY >= 0 && trackY <= windowHeight;
|
|
26027
|
+
var resolvePageScrubberGesturePosition = ({
|
|
26028
|
+
moveY,
|
|
26029
|
+
dy,
|
|
26030
|
+
trackY,
|
|
26031
|
+
windowHeight,
|
|
26032
|
+
trackHeight,
|
|
26033
|
+
thumbHeight,
|
|
26034
|
+
startThumbTop
|
|
26035
|
+
}) => {
|
|
26036
|
+
if (isPageScrubberTrackYTrusted(trackY, windowHeight)) {
|
|
26037
|
+
return moveY - trackY;
|
|
26038
|
+
}
|
|
26039
|
+
const travel = Math.max(0, trackHeight - thumbHeight);
|
|
26040
|
+
const nextThumbTop = Math.max(0, Math.min(travel, startThumbTop + dy));
|
|
26041
|
+
return nextThumbTop + thumbHeight / 2;
|
|
26042
|
+
};
|
|
26011
26043
|
|
|
26012
26044
|
// components/viewerNavigation.ts
|
|
26013
26045
|
var resolveViewerScrollTarget = (pageIndex, isDouble) => ({
|
|
@@ -26062,6 +26094,15 @@ var resolvePositiveInt = (value, fallback, min, max) => {
|
|
|
26062
26094
|
const rounded = Math.round(value);
|
|
26063
26095
|
return Math.max(min, Math.min(max, rounded));
|
|
26064
26096
|
};
|
|
26097
|
+
var scrollViewerListToOffset = (list, offset, animated) => {
|
|
26098
|
+
if (list === null) return;
|
|
26099
|
+
const nativeScrollRef = list.getNativeScrollRef?.();
|
|
26100
|
+
if (nativeScrollRef?.scrollTo) {
|
|
26101
|
+
nativeScrollRef.scrollTo({ y: offset, animated });
|
|
26102
|
+
return;
|
|
26103
|
+
}
|
|
26104
|
+
list.scrollToOffset?.({ offset, animated });
|
|
26105
|
+
};
|
|
26065
26106
|
var Viewer = ({
|
|
26066
26107
|
engine,
|
|
26067
26108
|
virtualWindowSize,
|
|
@@ -26134,6 +26175,7 @@ var Viewer = ({
|
|
|
26134
26175
|
const pendingScrollTimeoutRef = (0, import_react5.useRef)(
|
|
26135
26176
|
null
|
|
26136
26177
|
);
|
|
26178
|
+
const pendingScrollFrameRef = (0, import_react5.useRef)(null);
|
|
26137
26179
|
const pendingChromeShowTimeoutRef = (0, import_react5.useRef)(null);
|
|
26138
26180
|
const chromeVisibleRef = (0, import_react5.useRef)(mobileChromeVisible);
|
|
26139
26181
|
const lastScrollOffsetYRef = (0, import_react5.useRef)(0);
|
|
@@ -26141,6 +26183,7 @@ var Viewer = ({
|
|
|
26141
26183
|
const scrollUpAccumRef = (0, import_react5.useRef)(0);
|
|
26142
26184
|
const [layoutRevision, setLayoutRevision] = (0, import_react5.useState)(0);
|
|
26143
26185
|
const [selectionDragActive, setSelectionDragActive] = (0, import_react5.useState)(false);
|
|
26186
|
+
const [programmaticScrollActive, setProgrammaticScrollActive] = (0, import_react5.useState)(false);
|
|
26144
26187
|
const selectionDragActiveRef = (0, import_react5.useRef)(false);
|
|
26145
26188
|
const [gestureScrollLockActive, setGestureScrollLockActive] = (0, import_react5.useState)(false);
|
|
26146
26189
|
const gestureScrollLockActiveRef = (0, import_react5.useRef)(false);
|
|
@@ -26235,6 +26278,7 @@ var Viewer = ({
|
|
|
26235
26278
|
pendingScrollTargetRef.current = null;
|
|
26236
26279
|
pendingScrollAttemptsRef.current = 0;
|
|
26237
26280
|
clearPendingScrollRetry();
|
|
26281
|
+
setProgrammaticScrollActive(false);
|
|
26238
26282
|
}, [clearPendingScrollRetry]);
|
|
26239
26283
|
const clearPendingChromeShow = (0, import_react5.useCallback)(() => {
|
|
26240
26284
|
if (pendingChromeShowTimeoutRef.current) {
|
|
@@ -26289,6 +26333,10 @@ var Viewer = ({
|
|
|
26289
26333
|
cancelAnimationFrame(pinchAnchorRestoreFrameRef.current);
|
|
26290
26334
|
}
|
|
26291
26335
|
clearPendingScrollRetry();
|
|
26336
|
+
if (pendingScrollFrameRef.current !== null) {
|
|
26337
|
+
cancelAnimationFrame(pendingScrollFrameRef.current);
|
|
26338
|
+
pendingScrollFrameRef.current = null;
|
|
26339
|
+
}
|
|
26292
26340
|
clearPendingChromeShow();
|
|
26293
26341
|
},
|
|
26294
26342
|
[clearPendingChromeShow, clearPendingScrollRetry]
|
|
@@ -27142,12 +27190,20 @@ var Viewer = ({
|
|
|
27142
27190
|
(animated) => {
|
|
27143
27191
|
const target = pendingScrollTargetRef.current;
|
|
27144
27192
|
if (target === null || listRef.current === null) return;
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27193
|
+
setViewerScrollEnabledNative(true);
|
|
27194
|
+
if (pendingScrollFrameRef.current !== null) {
|
|
27195
|
+
cancelAnimationFrame(pendingScrollFrameRef.current);
|
|
27196
|
+
}
|
|
27197
|
+
pendingScrollFrameRef.current = requestAnimationFrame(() => {
|
|
27198
|
+
pendingScrollFrameRef.current = null;
|
|
27199
|
+
const nextTarget = pendingScrollTargetRef.current;
|
|
27200
|
+
const list = listRef.current;
|
|
27201
|
+
if (nextTarget === null || list === null) return;
|
|
27202
|
+
const offset = getFallbackOffsetForIndex(nextTarget.listIndex);
|
|
27203
|
+
scrollViewerListToOffset(list, offset, animated);
|
|
27148
27204
|
});
|
|
27149
27205
|
},
|
|
27150
|
-
[getFallbackOffsetForIndex]
|
|
27206
|
+
[getFallbackOffsetForIndex, setViewerScrollEnabledNative]
|
|
27151
27207
|
);
|
|
27152
27208
|
const restoreOrientationScrollOffset = (0, import_react5.useCallback)(() => {
|
|
27153
27209
|
if (pendingOrientationRestoreWidthRef.current !== windowWidth || pageCount <= 0 || isSingle || isWebView) {
|
|
@@ -27246,6 +27302,7 @@ var Viewer = ({
|
|
|
27246
27302
|
const target = resolveViewerScrollTarget(scrollToPageSignal, isDouble);
|
|
27247
27303
|
pendingScrollTargetRef.current = target;
|
|
27248
27304
|
pendingScrollAttemptsRef.current = 0;
|
|
27305
|
+
setProgrammaticScrollActive(true);
|
|
27249
27306
|
clearPendingScrollRetry();
|
|
27250
27307
|
setDocumentStateTracked(
|
|
27251
27308
|
{
|
|
@@ -27501,6 +27558,89 @@ var Viewer = ({
|
|
|
27501
27558
|
windowWidth
|
|
27502
27559
|
]
|
|
27503
27560
|
);
|
|
27561
|
+
const continuousList = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
27562
|
+
import_react_native4.FlatList,
|
|
27563
|
+
{
|
|
27564
|
+
ref: listRef,
|
|
27565
|
+
nestedScrollEnabled: true,
|
|
27566
|
+
data: isDouble ? rows : pages,
|
|
27567
|
+
style: { width: documentSurfaceWidth },
|
|
27568
|
+
initialNumToRender: FLATLIST_INITIAL_NUM_TO_RENDER,
|
|
27569
|
+
windowSize: resolvedWindowSize,
|
|
27570
|
+
maxToRenderPerBatch: resolvedMaxToRenderPerBatch,
|
|
27571
|
+
updateCellsBatchingPeriod: FLATLIST_UPDATE_CELLS_BATCHING_PERIOD,
|
|
27572
|
+
removeClippedSubviews: resolvedRemoveClippedSubviews,
|
|
27573
|
+
getItemLayout,
|
|
27574
|
+
keyExtractor,
|
|
27575
|
+
contentContainerStyle: styles4.listContent,
|
|
27576
|
+
renderItem,
|
|
27577
|
+
onViewableItemsChanged,
|
|
27578
|
+
viewabilityConfig: { itemVisiblePercentThreshold: 60 },
|
|
27579
|
+
scrollEnabled: pageScrubResolvedScrollEnabled || programmaticScrollActive,
|
|
27580
|
+
onLayout: () => {
|
|
27581
|
+
captureViewerFrame(listRef.current);
|
|
27582
|
+
restoreOrientationScrollOffset();
|
|
27583
|
+
scrollToPendingTarget(false);
|
|
27584
|
+
},
|
|
27585
|
+
onContentSizeChange: (_, height) => {
|
|
27586
|
+
viewerContentHeightRef.current = height;
|
|
27587
|
+
scrollToPendingTarget(false);
|
|
27588
|
+
},
|
|
27589
|
+
onScrollToIndexFailed: ({ index, averageItemLength }) => {
|
|
27590
|
+
const dataLength = isDouble ? rows.length : pages.length;
|
|
27591
|
+
if (index < 0 || index >= dataLength) return;
|
|
27592
|
+
const existingTarget = pendingScrollTargetRef.current;
|
|
27593
|
+
pendingScrollTargetRef.current = isDouble ? existingTarget?.listIndex === index ? existingTarget : resolveViewerScrollTarget(rows[index]?.left ?? index * 2, true) : resolveViewerScrollTarget(index, false);
|
|
27594
|
+
const offset = Math.max(0, getFallbackOffsetForIndex(index));
|
|
27595
|
+
scrollViewerListToOffset(listRef.current, offset, false);
|
|
27596
|
+
if (!isDouble) {
|
|
27597
|
+
ensurePageDimensions(index);
|
|
27598
|
+
} else {
|
|
27599
|
+
const row = rows[index];
|
|
27600
|
+
if (row) {
|
|
27601
|
+
ensurePageDimensions(row.left);
|
|
27602
|
+
if (row.right !== null) {
|
|
27603
|
+
ensurePageDimensions(row.right);
|
|
27604
|
+
}
|
|
27605
|
+
}
|
|
27606
|
+
}
|
|
27607
|
+
scheduleScrollRetry("onScrollToIndexFailed");
|
|
27608
|
+
if (perfEnabled) {
|
|
27609
|
+
logPerfEvent("Viewer", "scrollToIndexFailed", {
|
|
27610
|
+
index,
|
|
27611
|
+
averageItemLength,
|
|
27612
|
+
fallbackOffset: offset,
|
|
27613
|
+
fallbackSource: "cached-item-layout",
|
|
27614
|
+
itemCount: dataLength,
|
|
27615
|
+
retryAttempt: pendingScrollAttemptsRef.current
|
|
27616
|
+
});
|
|
27617
|
+
}
|
|
27618
|
+
},
|
|
27619
|
+
onScroll: (event) => handleViewerScroll(event, "continuous"),
|
|
27620
|
+
onScrollBeginDrag: perfEnabled ? () => {
|
|
27621
|
+
scrollMonitorRef.current.begin("continuous.beginDrag");
|
|
27622
|
+
} : void 0,
|
|
27623
|
+
onMomentumScrollBegin: perfEnabled ? () => {
|
|
27624
|
+
scrollMonitorRef.current.begin("continuous.momentumBegin");
|
|
27625
|
+
} : void 0,
|
|
27626
|
+
onScrollEndDrag: perfEnabled ? () => {
|
|
27627
|
+
scrollMonitorRef.current.end("continuous.endDrag");
|
|
27628
|
+
endViewerScroll("continuous.endDrag");
|
|
27629
|
+
sampleMemory("Viewer", "continuous.endDrag", {
|
|
27630
|
+
pageCount
|
|
27631
|
+
});
|
|
27632
|
+
} : void 0,
|
|
27633
|
+
onMomentumScrollEnd: perfEnabled ? () => {
|
|
27634
|
+
scrollMonitorRef.current.end("continuous.momentumEnd");
|
|
27635
|
+
endViewerScroll("continuous.momentumEnd");
|
|
27636
|
+
sampleMemory("Viewer", "continuous.momentumEnd", {
|
|
27637
|
+
pageCount
|
|
27638
|
+
});
|
|
27639
|
+
} : void 0,
|
|
27640
|
+
scrollEventThrottle: 16,
|
|
27641
|
+
showsVerticalScrollIndicator: false
|
|
27642
|
+
}
|
|
27643
|
+
);
|
|
27504
27644
|
if (isWebView) {
|
|
27505
27645
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, { style: [styles4.container, isDark && styles4.containerDark], children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
27506
27646
|
WebViewViewer_default,
|
|
@@ -27535,6 +27675,7 @@ var Viewer = ({
|
|
|
27535
27675
|
{
|
|
27536
27676
|
ref: horizontalScrollRef,
|
|
27537
27677
|
horizontal: true,
|
|
27678
|
+
nestedScrollEnabled: true,
|
|
27538
27679
|
scrollEnabled: !gestureScrollLockActive && !pageScrubActive && documentSurfaceWidth > windowWidth,
|
|
27539
27680
|
showsHorizontalScrollIndicator: false,
|
|
27540
27681
|
onScroll: (event) => {
|
|
@@ -27619,101 +27760,21 @@ var Viewer = ({
|
|
|
27619
27760
|
]
|
|
27620
27761
|
}
|
|
27621
27762
|
],
|
|
27622
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
27763
|
+
children: documentSurfaceWidth > windowWidth + 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
27623
27764
|
import_react_native4.ScrollView,
|
|
27624
27765
|
{
|
|
27625
27766
|
ref: horizontalScrollRef,
|
|
27626
27767
|
horizontal: true,
|
|
27627
|
-
|
|
27768
|
+
nestedScrollEnabled: true,
|
|
27769
|
+
scrollEnabled: !gestureScrollLockActive && !pageScrubActive,
|
|
27628
27770
|
showsHorizontalScrollIndicator: false,
|
|
27629
27771
|
onScroll: (event) => {
|
|
27630
27772
|
horizontalScrollOffsetRef.current = event.nativeEvent.contentOffset?.x ?? 0;
|
|
27631
27773
|
},
|
|
27632
27774
|
scrollEventThrottle: 16,
|
|
27633
|
-
children:
|
|
27634
|
-
import_react_native4.FlatList,
|
|
27635
|
-
{
|
|
27636
|
-
ref: listRef,
|
|
27637
|
-
data: isDouble ? rows : pages,
|
|
27638
|
-
style: { width: documentSurfaceWidth },
|
|
27639
|
-
initialNumToRender: FLATLIST_INITIAL_NUM_TO_RENDER,
|
|
27640
|
-
windowSize: resolvedWindowSize,
|
|
27641
|
-
maxToRenderPerBatch: resolvedMaxToRenderPerBatch,
|
|
27642
|
-
updateCellsBatchingPeriod: FLATLIST_UPDATE_CELLS_BATCHING_PERIOD,
|
|
27643
|
-
removeClippedSubviews: resolvedRemoveClippedSubviews,
|
|
27644
|
-
getItemLayout,
|
|
27645
|
-
keyExtractor,
|
|
27646
|
-
contentContainerStyle: styles4.listContent,
|
|
27647
|
-
renderItem,
|
|
27648
|
-
onViewableItemsChanged,
|
|
27649
|
-
viewabilityConfig: { itemVisiblePercentThreshold: 60 },
|
|
27650
|
-
scrollEnabled: pageScrubResolvedScrollEnabled,
|
|
27651
|
-
onLayout: () => {
|
|
27652
|
-
captureViewerFrame(listRef.current);
|
|
27653
|
-
restoreOrientationScrollOffset();
|
|
27654
|
-
scrollToPendingTarget(false);
|
|
27655
|
-
},
|
|
27656
|
-
onContentSizeChange: (_, height) => {
|
|
27657
|
-
viewerContentHeightRef.current = height;
|
|
27658
|
-
scrollToPendingTarget(false);
|
|
27659
|
-
},
|
|
27660
|
-
onScrollToIndexFailed: ({ index, averageItemLength }) => {
|
|
27661
|
-
const dataLength = isDouble ? rows.length : pages.length;
|
|
27662
|
-
if (index < 0 || index >= dataLength) return;
|
|
27663
|
-
const existingTarget = pendingScrollTargetRef.current;
|
|
27664
|
-
pendingScrollTargetRef.current = isDouble ? existingTarget?.listIndex === index ? existingTarget : resolveViewerScrollTarget(rows[index]?.left ?? index * 2, true) : resolveViewerScrollTarget(index, false);
|
|
27665
|
-
const offset = Math.max(0, getFallbackOffsetForIndex(index));
|
|
27666
|
-
listRef.current?.scrollToOffset({ offset, animated: false });
|
|
27667
|
-
if (!isDouble) {
|
|
27668
|
-
ensurePageDimensions(index);
|
|
27669
|
-
} else {
|
|
27670
|
-
const row = rows[index];
|
|
27671
|
-
if (row) {
|
|
27672
|
-
ensurePageDimensions(row.left);
|
|
27673
|
-
if (row.right !== null) {
|
|
27674
|
-
ensurePageDimensions(row.right);
|
|
27675
|
-
}
|
|
27676
|
-
}
|
|
27677
|
-
}
|
|
27678
|
-
scheduleScrollRetry("onScrollToIndexFailed");
|
|
27679
|
-
if (perfEnabled) {
|
|
27680
|
-
logPerfEvent("Viewer", "scrollToIndexFailed", {
|
|
27681
|
-
index,
|
|
27682
|
-
averageItemLength,
|
|
27683
|
-
fallbackOffset: offset,
|
|
27684
|
-
fallbackSource: "cached-item-layout",
|
|
27685
|
-
itemCount: dataLength,
|
|
27686
|
-
retryAttempt: pendingScrollAttemptsRef.current
|
|
27687
|
-
});
|
|
27688
|
-
}
|
|
27689
|
-
},
|
|
27690
|
-
onScroll: (event) => handleViewerScroll(event, "continuous"),
|
|
27691
|
-
onScrollBeginDrag: perfEnabled ? () => {
|
|
27692
|
-
scrollMonitorRef.current.begin("continuous.beginDrag");
|
|
27693
|
-
} : void 0,
|
|
27694
|
-
onMomentumScrollBegin: perfEnabled ? () => {
|
|
27695
|
-
scrollMonitorRef.current.begin("continuous.momentumBegin");
|
|
27696
|
-
} : void 0,
|
|
27697
|
-
onScrollEndDrag: perfEnabled ? () => {
|
|
27698
|
-
scrollMonitorRef.current.end("continuous.endDrag");
|
|
27699
|
-
endViewerScroll("continuous.endDrag");
|
|
27700
|
-
sampleMemory("Viewer", "continuous.endDrag", {
|
|
27701
|
-
pageCount
|
|
27702
|
-
});
|
|
27703
|
-
} : void 0,
|
|
27704
|
-
onMomentumScrollEnd: perfEnabled ? () => {
|
|
27705
|
-
scrollMonitorRef.current.end("continuous.momentumEnd");
|
|
27706
|
-
endViewerScroll("continuous.momentumEnd");
|
|
27707
|
-
sampleMemory("Viewer", "continuous.momentumEnd", {
|
|
27708
|
-
pageCount
|
|
27709
|
-
});
|
|
27710
|
-
} : void 0,
|
|
27711
|
-
scrollEventThrottle: 16,
|
|
27712
|
-
showsVerticalScrollIndicator: false
|
|
27713
|
-
}
|
|
27714
|
-
)
|
|
27775
|
+
children: continuousList
|
|
27715
27776
|
}
|
|
27716
|
-
)
|
|
27777
|
+
) : continuousList
|
|
27717
27778
|
}
|
|
27718
27779
|
) }) });
|
|
27719
27780
|
};
|
|
@@ -32084,10 +32145,13 @@ function ProgressPill({
|
|
|
32084
32145
|
const isDark = uiTheme === "dark";
|
|
32085
32146
|
const offsets = resolveMobileChromeOffsets(usePapyrusSafeAreaInsets());
|
|
32086
32147
|
const { height: windowHeight } = (0, import_react_native17.useWindowDimensions)();
|
|
32087
|
-
const
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
|
|
32148
|
+
const windowHeightRef = (0, import_react14.useRef)(windowHeight);
|
|
32149
|
+
windowHeightRef.current = windowHeight;
|
|
32150
|
+
const trackHeight = resolvePageScrubberTrackHeight({
|
|
32151
|
+
windowHeight,
|
|
32152
|
+
topOffset: offsets.progress,
|
|
32153
|
+
bottomOffset: offsets.bottom
|
|
32154
|
+
});
|
|
32091
32155
|
const thumbHeight = 44;
|
|
32092
32156
|
const trackYRef = (0, import_react14.useRef)(0);
|
|
32093
32157
|
const scrubberRef = (0, import_react14.useRef)(null);
|
|
@@ -32134,6 +32198,9 @@ function ProgressPill({
|
|
|
32134
32198
|
const thumbTopRef = (0, import_react14.useRef)(new import_react_native17.Animated.Value(thumbTop));
|
|
32135
32199
|
const thumbTopSnapshotRef = (0, import_react14.useRef)(thumbTop);
|
|
32136
32200
|
thumbTopSnapshotRef.current = thumbTop;
|
|
32201
|
+
const scrubStartThumbTopRef = (0, import_react14.useRef)(0);
|
|
32202
|
+
const trackReveal = (0, import_react14.useRef)(new import_react_native17.Animated.Value(0)).current;
|
|
32203
|
+
const [trackOriginY, setTrackOriginY] = (0, import_react14.useState)(0);
|
|
32137
32204
|
const scrubberMetricsRef = (0, import_react14.useRef)({ trackHeight, thumbHeight, pageCount });
|
|
32138
32205
|
scrubberMetricsRef.current = { trackHeight, thumbHeight, pageCount };
|
|
32139
32206
|
(0, import_react14.useEffect)(() => {
|
|
@@ -32201,6 +32268,20 @@ function ProgressPill({
|
|
|
32201
32268
|
onScrubbingChangeRef.current?.(true);
|
|
32202
32269
|
hasMovedRef.current = false;
|
|
32203
32270
|
longPressTriggeredRef.current = false;
|
|
32271
|
+
scrubStartThumbTopRef.current = thumbTopSnapshotRef.current;
|
|
32272
|
+
setTrackOriginY(
|
|
32273
|
+
resolvePageScrubberTrackRevealOrigin({
|
|
32274
|
+
thumbTop: thumbTopSnapshotRef.current,
|
|
32275
|
+
thumbHeight,
|
|
32276
|
+
trackHeight: scrubberMetricsRef.current.trackHeight
|
|
32277
|
+
})
|
|
32278
|
+
);
|
|
32279
|
+
trackReveal.setValue(0);
|
|
32280
|
+
import_react_native17.Animated.timing(trackReveal, {
|
|
32281
|
+
toValue: 1,
|
|
32282
|
+
duration: 180,
|
|
32283
|
+
useNativeDriver: false
|
|
32284
|
+
}).start();
|
|
32204
32285
|
scrubNavigationControllerRef.current.begin();
|
|
32205
32286
|
pendingReleasedScrubPageRef.current = null;
|
|
32206
32287
|
setScrubPreviewPage(currentPageRef.current);
|
|
@@ -32222,7 +32303,18 @@ function ProgressPill({
|
|
|
32222
32303
|
clearTimeout(longPressTimerRef.current);
|
|
32223
32304
|
longPressTimerRef.current = null;
|
|
32224
32305
|
}
|
|
32225
|
-
|
|
32306
|
+
const { trackHeight: trackHeight2, thumbHeight: thumbHeight2 } = scrubberMetricsRef.current;
|
|
32307
|
+
scrubToPositionRef.current(
|
|
32308
|
+
resolvePageScrubberGesturePosition({
|
|
32309
|
+
moveY: gestureState.moveY,
|
|
32310
|
+
dy: gestureState.dy,
|
|
32311
|
+
trackY: trackYRef.current,
|
|
32312
|
+
windowHeight: windowHeightRef.current,
|
|
32313
|
+
trackHeight: trackHeight2,
|
|
32314
|
+
thumbHeight: thumbHeight2,
|
|
32315
|
+
startThumbTop: scrubStartThumbTopRef.current
|
|
32316
|
+
})
|
|
32317
|
+
);
|
|
32226
32318
|
},
|
|
32227
32319
|
onPanResponderRelease: () => {
|
|
32228
32320
|
if (longPressTimerRef.current !== null) {
|
|
@@ -32231,6 +32323,11 @@ function ProgressPill({
|
|
|
32231
32323
|
}
|
|
32232
32324
|
isScrubbingRef.current = false;
|
|
32233
32325
|
onScrubbingChangeRef.current?.(false);
|
|
32326
|
+
import_react_native17.Animated.timing(trackReveal, {
|
|
32327
|
+
toValue: 0,
|
|
32328
|
+
duration: 140,
|
|
32329
|
+
useNativeDriver: false
|
|
32330
|
+
}).start();
|
|
32234
32331
|
const releasedPage = scrubNavigationControllerRef.current.release();
|
|
32235
32332
|
const releaseAction = resolvePageScrubberReleaseAction({
|
|
32236
32333
|
hasMoved: hasMovedRef.current,
|
|
@@ -32257,6 +32354,11 @@ function ProgressPill({
|
|
|
32257
32354
|
}
|
|
32258
32355
|
isScrubbingRef.current = false;
|
|
32259
32356
|
onScrubbingChangeRef.current?.(false);
|
|
32357
|
+
import_react_native17.Animated.timing(trackReveal, {
|
|
32358
|
+
toValue: 0,
|
|
32359
|
+
duration: 140,
|
|
32360
|
+
useNativeDriver: false
|
|
32361
|
+
}).start();
|
|
32260
32362
|
scrubNavigationControllerRef.current.cancel();
|
|
32261
32363
|
pendingReleasedScrubPageRef.current = null;
|
|
32262
32364
|
setScrubPreviewPage(null);
|
|
@@ -32276,6 +32378,7 @@ function ProgressPill({
|
|
|
32276
32378
|
pointerEvents: "box-none",
|
|
32277
32379
|
style: [
|
|
32278
32380
|
styles17.frame,
|
|
32381
|
+
resolvePageScrubberOverlayStyle(),
|
|
32279
32382
|
{
|
|
32280
32383
|
top: offsets.progress,
|
|
32281
32384
|
right: offsets.right
|
|
@@ -32285,6 +32388,7 @@ function ProgressPill({
|
|
|
32285
32388
|
import_react_native17.View,
|
|
32286
32389
|
{
|
|
32287
32390
|
ref: scrubberRef,
|
|
32391
|
+
pointerEvents: resolvePageScrubberPointerEvents(),
|
|
32288
32392
|
style: [styles17.scrubber, { height: trackHeight }],
|
|
32289
32393
|
...scrubberPanHandlers,
|
|
32290
32394
|
onLayout: () => {
|
|
@@ -32293,7 +32397,21 @@ function ProgressPill({
|
|
|
32293
32397
|
});
|
|
32294
32398
|
},
|
|
32295
32399
|
children: [
|
|
32296
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
32400
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
32401
|
+
import_react_native17.Animated.View,
|
|
32402
|
+
{
|
|
32403
|
+
style: [
|
|
32404
|
+
styles17.track,
|
|
32405
|
+
isDark && styles17.trackDark,
|
|
32406
|
+
{
|
|
32407
|
+
transformOrigin: [0, trackOriginY, 0],
|
|
32408
|
+
opacity: trackReveal,
|
|
32409
|
+
transform: [{ scaleY: trackReveal }],
|
|
32410
|
+
elevation: 6
|
|
32411
|
+
}
|
|
32412
|
+
]
|
|
32413
|
+
}
|
|
32414
|
+
),
|
|
32297
32415
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native17.Animated.View, { style: [styles17.thumb, { top: thumbTopRef.current }], children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
32298
32416
|
import_react_native17.View,
|
|
32299
32417
|
{
|
|
@@ -32341,7 +32459,7 @@ var styles17 = import_react_native17.StyleSheet.create({
|
|
|
32341
32459
|
track: {
|
|
32342
32460
|
position: "absolute",
|
|
32343
32461
|
top: 0,
|
|
32344
|
-
right:
|
|
32462
|
+
right: 0,
|
|
32345
32463
|
bottom: 0,
|
|
32346
32464
|
width: 3,
|
|
32347
32465
|
borderRadius: 2,
|