@papyrus-sdk/ui-react-native 0.2.27 → 0.2.29

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.d.mts CHANGED
@@ -202,4 +202,11 @@ declare const MOBILE_CHROME_METRICS: {
202
202
  readonly progressHorizontalOffset: 10;
203
203
  };
204
204
 
205
- export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, InfoSheet, MOBILE_CHROME_METRICS, MobilePerfProvider, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer, createPerfSession, createRunId, useMobilePerf };
205
+ type IconProps = {
206
+ size?: number;
207
+ color?: string;
208
+ strokeWidth?: number;
209
+ };
210
+ declare const IconPageNav: React.FC<IconProps>;
211
+
212
+ export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, IconPageNav, InfoSheet, MOBILE_CHROME_METRICS, MobilePerfProvider, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer, createPerfSession, createRunId, useMobilePerf };
package/dist/index.d.ts CHANGED
@@ -202,4 +202,11 @@ declare const MOBILE_CHROME_METRICS: {
202
202
  readonly progressHorizontalOffset: 10;
203
203
  };
204
204
 
205
- export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, InfoSheet, MOBILE_CHROME_METRICS, MobilePerfProvider, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer, createPerfSession, createRunId, useMobilePerf };
205
+ type IconProps = {
206
+ size?: number;
207
+ color?: string;
208
+ strokeWidth?: number;
209
+ };
210
+ declare const IconPageNav: React.FC<IconProps>;
211
+
212
+ export { AnnotationEditor, BottomBar, CoverPreview, DocumentActionsSheet, IconPageNav, InfoSheet, MOBILE_CHROME_METRICS, MobilePerfProvider, DedicatedAndroidPdfViewer as NativePdfDocumentViewer, OverflowSheet, _default as PageRenderer, ProgressPill, ReadingShell, RightSheet, SearchOverlay, SearchResultsSheet, SettingsSheet, ToolDock, Topbar, Viewer, createPerfSession, createRunId, useMobilePerf };
package/dist/index.js CHANGED
@@ -22176,6 +22176,7 @@ __export(ui_react_native_exports, {
22176
22176
  BottomBar: () => BottomBar_default,
22177
22177
  CoverPreview: () => CoverPreview_default,
22178
22178
  DocumentActionsSheet: () => DocumentActionsSheet,
22179
+ IconPageNav: () => IconPageNav,
22179
22180
  InfoSheet: () => InfoSheet,
22180
22181
  MOBILE_CHROME_METRICS: () => MOBILE_CHROME_METRICS,
22181
22182
  MobilePerfProvider: () => MobilePerfProvider,
@@ -27137,6 +27138,17 @@ var Viewer = ({
27137
27138
  },
27138
27139
  [scaledListLayoutMetrics]
27139
27140
  );
27141
+ const scrollToPendingTarget = (0, import_react5.useCallback)(
27142
+ (animated) => {
27143
+ const target = pendingScrollTargetRef.current;
27144
+ if (target === null || listRef.current === null) return;
27145
+ listRef.current.scrollToOffset({
27146
+ offset: Math.max(0, getFallbackOffsetForIndex(target.listIndex)),
27147
+ animated
27148
+ });
27149
+ },
27150
+ [getFallbackOffsetForIndex]
27151
+ );
27140
27152
  const restoreOrientationScrollOffset = (0, import_react5.useCallback)(() => {
27141
27153
  if (pendingOrientationRestoreWidthRef.current !== windowWidth || pageCount <= 0 || isSingle || isWebView) {
27142
27154
  return;
@@ -27167,6 +27179,11 @@ var Viewer = ({
27167
27179
  }
27168
27180
  restoreOrientationScrollOffset();
27169
27181
  }, [restoreOrientationScrollOffset, windowWidth]);
27182
+ (0, import_react5.useEffect)(() => {
27183
+ if (pendingScrollTargetRef.current !== null) {
27184
+ scrollToPendingTarget(false);
27185
+ }
27186
+ }, [layoutRevision, scrollToPendingTarget]);
27170
27187
  const getItemLayout = (0, import_react5.useCallback)(
27171
27188
  (_, index) => {
27172
27189
  if (scaledListLayoutMetrics.itemCount === 0) {
@@ -27237,15 +27254,12 @@ var Viewer = ({
27237
27254
  },
27238
27255
  "scrollToPageSignal.flatList"
27239
27256
  );
27240
- listRef.current?.scrollToIndex({
27241
- index: target.listIndex,
27242
- animated: true,
27243
- viewPosition: 0
27244
- });
27257
+ scrollToPendingTarget(true);
27245
27258
  }, [
27246
27259
  clearPendingScrollRetry,
27247
27260
  clearPendingScrollTarget,
27248
27261
  ensurePageDimensions,
27262
+ scrollToPendingTarget,
27249
27263
  scrollToPageSignal,
27250
27264
  pageCount,
27251
27265
  setDocumentStateTracked,
@@ -27637,9 +27651,11 @@ var Viewer = ({
27637
27651
  onLayout: () => {
27638
27652
  captureViewerFrame(listRef.current);
27639
27653
  restoreOrientationScrollOffset();
27654
+ scrollToPendingTarget(false);
27640
27655
  },
27641
27656
  onContentSizeChange: (_, height) => {
27642
27657
  viewerContentHeightRef.current = height;
27658
+ scrollToPendingTarget(false);
27643
27659
  },
27644
27660
  onScrollToIndexFailed: ({ index, averageItemLength }) => {
27645
27661
  const dataLength = isDouble ? rows.length : pages.length;
@@ -27861,25 +27877,73 @@ function NativeSheet({
27861
27877
  }) {
27862
27878
  const insets = usePapyrusSafeAreaInsets();
27863
27879
  const palette = getNativeSheetPalette(Boolean(isDark));
27880
+ const { height: windowHeight } = (0, import_react_native5.useWindowDimensions)();
27881
+ const [rendered, setRendered] = (0, import_react7.useState)(visible);
27882
+ const renderedRef = (0, import_react7.useRef)(visible);
27883
+ const motion = (0, import_react7.useRef)(new import_react_native5.Animated.Value(visible ? 0 : 1)).current;
27884
+ const backdropOpacity = (0, import_react7.useRef)(new import_react_native5.Animated.Value(visible ? 1 : 0)).current;
27885
+ (0, import_react7.useEffect)(() => {
27886
+ motion.stopAnimation();
27887
+ backdropOpacity.stopAnimation();
27888
+ if (visible) {
27889
+ renderedRef.current = true;
27890
+ setRendered(true);
27891
+ motion.setValue(1);
27892
+ backdropOpacity.setValue(0);
27893
+ import_react_native5.Animated.parallel([
27894
+ import_react_native5.Animated.spring(motion, {
27895
+ toValue: 0,
27896
+ damping: 22,
27897
+ stiffness: 220,
27898
+ mass: 0.8,
27899
+ useNativeDriver: true
27900
+ }),
27901
+ import_react_native5.Animated.timing(backdropOpacity, {
27902
+ toValue: 1,
27903
+ duration: 180,
27904
+ useNativeDriver: true
27905
+ })
27906
+ ]).start();
27907
+ return;
27908
+ }
27909
+ if (!renderedRef.current) return;
27910
+ import_react_native5.Animated.parallel([
27911
+ import_react_native5.Animated.timing(motion, {
27912
+ toValue: 1,
27913
+ duration: 180,
27914
+ useNativeDriver: true
27915
+ }),
27916
+ import_react_native5.Animated.timing(backdropOpacity, {
27917
+ toValue: 0,
27918
+ duration: 140,
27919
+ useNativeDriver: true
27920
+ })
27921
+ ]).start(({ finished }) => {
27922
+ if (!finished) return;
27923
+ renderedRef.current = false;
27924
+ setRendered(false);
27925
+ });
27926
+ }, [backdropOpacity, motion, visible]);
27927
+ if (!rendered) return null;
27864
27928
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
27865
27929
  import_react_native5.Modal,
27866
27930
  {
27867
- animationType: "fade",
27931
+ animationType: "none",
27868
27932
  transparent: true,
27869
- visible,
27933
+ visible: rendered,
27870
27934
  onRequestClose: onClose,
27871
27935
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native5.View, { style: styles5.root, children: [
27872
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
27936
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native5.Animated.View, { style: [styles5.backdrop, { opacity: backdropOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
27873
27937
  import_react_native5.Pressable,
27874
27938
  {
27875
27939
  accessibilityRole: "button",
27876
27940
  accessibilityLabel: closeAccessibilityLabel,
27877
- style: styles5.backdrop,
27941
+ style: import_react_native5.StyleSheet.absoluteFill,
27878
27942
  onPress: onClose
27879
27943
  }
27880
- ),
27944
+ ) }),
27881
27945
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
27882
- import_react_native5.View,
27946
+ import_react_native5.Animated.View,
27883
27947
  {
27884
27948
  style: [
27885
27949
  styles5.sheet,
@@ -27890,7 +27954,17 @@ function NativeSheet({
27890
27954
  backgroundColor: palette.backgroundColor,
27891
27955
  borderTopColor: palette.borderColor
27892
27956
  },
27893
- sheetStyle
27957
+ sheetStyle,
27958
+ {
27959
+ transform: [
27960
+ {
27961
+ translateY: motion.interpolate({
27962
+ inputRange: [0, 1],
27963
+ outputRange: [0, windowHeight]
27964
+ })
27965
+ }
27966
+ ]
27967
+ }
27894
27968
  ],
27895
27969
  children: [
27896
27970
  showHeader ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native5.View, { style: styles5.header, children: [
@@ -32871,7 +32945,11 @@ function ReadingShell({
32871
32945
  setSearchResultsOpen(false);
32872
32946
  closeMobileDestination();
32873
32947
  },
32874
- onOpenResults: () => setSearchResultsOpen(true)
32948
+ onOpenResults: () => {
32949
+ import_react_native20.Keyboard.dismiss();
32950
+ setSearchResultsOpen(true);
32951
+ closeMobileDestination();
32952
+ }
32875
32953
  }
32876
32954
  ),
32877
32955
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -32967,6 +33045,7 @@ var styles20 = import_react_native20.StyleSheet.create({
32967
33045
  BottomBar,
32968
33046
  CoverPreview,
32969
33047
  DocumentActionsSheet,
33048
+ IconPageNav,
32970
33049
  InfoSheet,
32971
33050
  MOBILE_CHROME_METRICS,
32972
33051
  MobilePerfProvider,