@onekeyfe/react-native-pager-view 6.7.0-3 → 6.7.0-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/README.md +21 -0
- package/android/build.gradle +1 -0
- package/android/src/androidTest/AndroidManifest.xml +7 -0
- package/android/src/androidTest/java/com/reactnativepagerview/CollapsiblePagerTabReservationTest.kt +476 -0
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerHost.kt +215 -39
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerNativeHeaders.kt +518 -21
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +40 -0
- package/android/src/main/java/com/reactnativepagerview/NativeScrollerScrollAwayInsets.kt +19 -0
- package/android/src/main/java/com/reactnativepagerview/NativeScrollerView.kt +50 -6
- package/android/src/main/java/com/reactnativepagerview/NestedScrollableHost.kt +8 -2
- package/android/src/main/java/com/reactnativepagerview/event/NativeHeaderPressEvent.kt +8 -0
- package/android/src/test/java/com/reactnativepagerview/NativeScrollerScrollAwayInsetsTest.kt +40 -0
- package/docs/SPEC.md +606 -10
- package/ios/RNCCollapsiblePagerViewComponentView.mm +1903 -91
- package/ios/RNCNativeScrollerComponentView.h +2 -0
- package/ios/RNCNativeScrollerComponentView.mm +42 -0
- package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +562 -1
- package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +1116 -0
- package/ios/tests/RNCCollapsiblePagerPressCancellationTests.mm +74 -9
- package/ios/tests/RNCCollapsiblePagerRefreshControlTests.mm +50 -0
- package/lib/module/CollapsiblePagerView.js +70 -11
- package/lib/module/CollapsiblePagerView.web.js +532 -8
- package/lib/module/CollapsiblePagerViewNativeComponent.ts +57 -42
- package/lib/module/NativeScroller.web.js +3 -0
- package/lib/module/NativeScrollerNativeComponent.ts +42 -46
- package/lib/module/PagerViewNativeComponent.ts +20 -25
- package/lib/module/WebCollapsiblePagerPage.js +7 -2
- package/lib/module/index.native.js +9 -0
- package/lib/typescript/src/CollapsiblePagerView.d.ts +42 -4
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +48 -2
- package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +54 -38
- package/lib/typescript/src/NativeScroller.d.ts +5 -3
- package/lib/typescript/src/NativeScroller.web.d.ts +1 -1
- package/lib/typescript/src/NativeScrollerNativeComponent.d.ts +47 -48
- package/lib/typescript/src/PagerView.d.ts +1 -1
- package/lib/typescript/src/PagerView.web.d.ts +1 -1
- package/lib/typescript/src/PagerViewNativeComponent.d.ts +20 -21
- package/lib/typescript/src/WebCollapsiblePagerPage.d.ts +1 -1
- package/lib/typescript/src/index.native.d.ts +13 -0
- package/lib/typescript/src/usePagerView.d.ts +2 -2
- package/lib/typescript/src/utils.d.ts +2 -2
- package/package.json +22 -7
- package/react-native-pager-view.podspec +1 -0
- package/src/CollapsiblePagerView.tsx +179 -12
- package/src/CollapsiblePagerView.web.tsx +486 -7
- package/src/CollapsiblePagerViewNativeComponent.ts +57 -42
- package/src/NativeScroller.tsx +14 -4
- package/src/NativeScroller.web.tsx +15 -1
- package/src/NativeScrollerNativeComponent.ts +42 -46
- package/src/PagerViewNativeComponent.ts +20 -25
- package/src/WebCollapsiblePagerPage.tsx +7 -2
- package/src/index.native.tsx +30 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ScrollEdgeEffect } from "./ScrollEdgeEffect";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { createNamedIcon } from "@onekeyfe/react-native-image/icon/dom";
|
|
4
|
+
import type { CollapsiblePagerNativeTabBarConfig, CollapsiblePagerToolbarItem, CollapsiblePagerToolbarPress, CollapsiblePagerViewOnNativeTabPressEvent } from "./CollapsiblePagerView";
|
|
5
|
+
export type { CollapsiblePagerNativeTabBarConfig, CollapsiblePagerNativeTabBarItem, CollapsiblePagerNativeTabBarStyle, CollapsiblePagerToolbarItem, CollapsiblePagerToolbarPress } from "./CollapsiblePagerView";
|
|
6
|
+
import { I18nManager, Platform, processColor, StyleSheet, View } from "react-native";
|
|
4
7
|
import type * as ReactNative from "react-native";
|
|
5
8
|
|
|
6
9
|
import { WebCollapsiblePagerPage } from "./WebCollapsiblePagerPage";
|
|
@@ -66,10 +69,15 @@ export interface CollapsiblePagerViewProps
|
|
|
66
69
|
| "retainedPages"
|
|
67
70
|
| "layoutDirection"
|
|
68
71
|
> {
|
|
72
|
+
nativeTabBar?: CollapsiblePagerNativeTabBarConfig;
|
|
73
|
+
nativeTabPressAnimationEnabled?: boolean;
|
|
74
|
+
onNativeTabPress?: (event: CollapsiblePagerViewOnNativeTabPressEvent) => void;
|
|
75
|
+
onNativeToolbarPress?: (event: ReactNative.NativeSyntheticEvent<CollapsiblePagerToolbarPress>) => void;
|
|
69
76
|
header: React.ReactNode;
|
|
70
77
|
stickyHeader: React.ReactNode;
|
|
71
78
|
headerHeight?: number;
|
|
72
79
|
stickyHeaderHeight?: number;
|
|
80
|
+
stickyHeaderHeights?: readonly number[];
|
|
73
81
|
isActive?: boolean;
|
|
74
82
|
topOverlay?: React.ReactNode;
|
|
75
83
|
topScrollEdgeEffect?: `${ScrollEdgeEffect}`;
|
|
@@ -188,6 +196,10 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
188
196
|
|
|
189
197
|
private root: HTMLElement | null = null;
|
|
190
198
|
private track: HTMLElement | null = null;
|
|
199
|
+
private tabProgress: number | null = null;
|
|
200
|
+
private tabProgressFrame: number | null = null;
|
|
201
|
+
private tabProgressGeneration = 0;
|
|
202
|
+
private tabButtons = new Map<string, HTMLButtonElement>();
|
|
191
203
|
private headerSlot: HTMLElement | null = null;
|
|
192
204
|
private stickySlot: HTMLElement | null = null;
|
|
193
205
|
private cssTimelineSupported = false;
|
|
@@ -236,6 +248,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
236
248
|
key: string;
|
|
237
249
|
}> | null = null;
|
|
238
250
|
private transitionTimer: ReturnType<typeof setTimeout> | null = null;
|
|
251
|
+
private transitionGeneration = 0;
|
|
239
252
|
private pageScrollState: OnPageScrollStateChangedEventData["pageScrollState"] =
|
|
240
253
|
"idle";
|
|
241
254
|
private configuredScrollElement: ConfiguredScrollElement | null = null;
|
|
@@ -290,6 +303,9 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
290
303
|
this.scheduleScrollConfiguration();
|
|
291
304
|
this.syncFallbackHeader();
|
|
292
305
|
this.notifyMountedPagesChanged();
|
|
306
|
+
this.syncToolbar();
|
|
307
|
+
this.tabProgress = this.state.selectedPage;
|
|
308
|
+
this.syncTabColors();
|
|
293
309
|
this.emitDiagnostics("mounted");
|
|
294
310
|
}
|
|
295
311
|
|
|
@@ -359,6 +375,10 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
359
375
|
this.scheduleScrollConfiguration();
|
|
360
376
|
this.syncFallbackHeader();
|
|
361
377
|
this.notifyMountedPagesChanged();
|
|
378
|
+
this.syncToolbar();
|
|
379
|
+
if (previousProps.isActive === false && this.props.isActive !== false) this.readTabProgress();
|
|
380
|
+
if (this.props.isActive === false || !this.tabColorWeights()) this.cancelTabProgressFrame();
|
|
381
|
+
this.syncTabColors();
|
|
362
382
|
}
|
|
363
383
|
|
|
364
384
|
componentWillUnmount() {
|
|
@@ -366,6 +386,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
366
386
|
const routeTarget = this.captureRouteTarget(this.props);
|
|
367
387
|
if (routeTarget) this.setRouteTarget(routeTarget);
|
|
368
388
|
this.disposed = true;
|
|
389
|
+
this.setToolbarSlot(null);
|
|
369
390
|
this.selectionRestoreToken += 1;
|
|
370
391
|
this.cancelPendingTopFrame();
|
|
371
392
|
this.savePageOffset(this.state.selectedPage);
|
|
@@ -411,6 +432,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
411
432
|
|
|
412
433
|
private observeChrome() {
|
|
413
434
|
this.chromeObserver = new ResizeObserver(this.scheduleChromeMeasurement);
|
|
435
|
+
if (this.root) this.chromeObserver.observe(this.root);
|
|
414
436
|
if (this.headerContent) this.chromeObserver.observe(this.headerContent);
|
|
415
437
|
if (this.stickyContent) this.chromeObserver.observe(this.stickyContent);
|
|
416
438
|
this.scheduleChromeMeasurement();
|
|
@@ -439,6 +461,8 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
439
461
|
this.measuredStickyHeight = nextSticky;
|
|
440
462
|
this.headerMeasured = Boolean(header?.isConnected);
|
|
441
463
|
this.stickyMeasured = Boolean(sticky?.isConnected);
|
|
464
|
+
this.syncToolbar();
|
|
465
|
+
this.syncTabColors();
|
|
442
466
|
if (headerChanged || stickyChanged) {
|
|
443
467
|
this.forceUpdate();
|
|
444
468
|
this.scheduleScrollConfiguration();
|
|
@@ -580,6 +604,23 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
580
604
|
this.scrollCurrentPageToTop(0, options?.animated ?? true);
|
|
581
605
|
};
|
|
582
606
|
|
|
607
|
+
public scrollHeaderBy = (delta: number) => {
|
|
608
|
+
if (!Number.isFinite(delta)) return;
|
|
609
|
+
const offset = Math.min(
|
|
610
|
+
this.headerHeight,
|
|
611
|
+
Math.max(0, this.sharedHeaderOffset + delta)
|
|
612
|
+
);
|
|
613
|
+
this.scrollCurrentPageToTop(offset, false);
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
public scrollHeaderToOffset = (offset: number) => {
|
|
617
|
+
if (!Number.isFinite(offset)) return;
|
|
618
|
+
this.scrollCurrentPageToTop(
|
|
619
|
+
Math.min(this.headerHeight, Math.max(0, offset)),
|
|
620
|
+
false
|
|
621
|
+
);
|
|
622
|
+
};
|
|
623
|
+
|
|
583
624
|
public scrollToStickyTop = (options?: Readonly<{ animated?: boolean }>) => {
|
|
584
625
|
this.scrollCurrentPageToTop(
|
|
585
626
|
this.headerHeight,
|
|
@@ -674,10 +715,10 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
674
715
|
)
|
|
675
716
|
return;
|
|
676
717
|
this.pageOffsets.set(key, 0);
|
|
677
|
-
this.sharedHeaderOffset = offset;
|
|
718
|
+
this.sharedHeaderOffset = Math.min(this.headerHeight, Math.max(0, offset));
|
|
678
719
|
this.bodyAlignment = { element, key };
|
|
679
720
|
scrollElementTo(element, {
|
|
680
|
-
top:
|
|
721
|
+
top: this.sharedHeaderOffset,
|
|
681
722
|
behavior: animated ? "smooth" : "instant",
|
|
682
723
|
});
|
|
683
724
|
this.syncFallbackHeader();
|
|
@@ -724,21 +765,32 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
724
765
|
}
|
|
725
766
|
|
|
726
767
|
private finishPageTransition = () => {
|
|
768
|
+
this.transitionGeneration += 1;
|
|
727
769
|
if (this.transitionTimer !== null) {
|
|
728
770
|
clearTimeout(this.transitionTimer);
|
|
729
771
|
this.transitionTimer = null;
|
|
730
772
|
}
|
|
773
|
+
this.readTabProgress();
|
|
774
|
+
this.cancelTabProgressFrame();
|
|
775
|
+
this.syncTabColors();
|
|
731
776
|
this.emitPageScrollState("idle");
|
|
777
|
+
this.syncToolbar();
|
|
732
778
|
};
|
|
733
779
|
|
|
734
780
|
private beginPageTransition() {
|
|
781
|
+
this.suspendToolbar();
|
|
735
782
|
if (this.transitionTimer !== null) clearTimeout(this.transitionTimer);
|
|
783
|
+
const generation = ++this.transitionGeneration;
|
|
736
784
|
this.emitPageScrollState("settling");
|
|
737
|
-
this.transitionTimer = setTimeout(
|
|
785
|
+
this.transitionTimer = setTimeout(() => {
|
|
786
|
+
if (generation === this.transitionGeneration) this.finishPageTransition();
|
|
787
|
+
}, 320);
|
|
738
788
|
}
|
|
739
789
|
|
|
740
790
|
private onTrackTransitionEnd = (event: TransitionEvent) => {
|
|
741
791
|
if (event.target === this.track && event.propertyName === "transform") {
|
|
792
|
+
this.readTabProgress();
|
|
793
|
+
if (this.tabColorWeights() && this.tabProgress !== null && Math.abs(this.tabProgress - this.state.selectedPage) > 0.001) return;
|
|
742
794
|
this.finishPageTransition();
|
|
743
795
|
}
|
|
744
796
|
};
|
|
@@ -746,11 +798,120 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
746
798
|
private setTrack = (node: unknown) => {
|
|
747
799
|
const track = webElement(node);
|
|
748
800
|
if (track === this.track) return;
|
|
801
|
+
this.cancelTabProgressFrame();
|
|
749
802
|
this.track?.removeEventListener("transitionend", this.onTrackTransitionEnd);
|
|
750
803
|
this.track = track;
|
|
751
804
|
this.track?.addEventListener("transitionend", this.onTrackTransitionEnd);
|
|
752
805
|
};
|
|
753
806
|
|
|
807
|
+
private cancelTabProgressFrame() {
|
|
808
|
+
this.tabProgressGeneration += 1;
|
|
809
|
+
if (this.tabProgressFrame !== null) cancelAnimationFrame(this.tabProgressFrame);
|
|
810
|
+
this.tabProgressFrame = null;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
private readTabProgress() {
|
|
814
|
+
const track = this.track;
|
|
815
|
+
const width = this.root?.getBoundingClientRect().width ?? 0;
|
|
816
|
+
if (!track?.isConnected || width <= 0) return null;
|
|
817
|
+
const transform = track.ownerDocument.defaultView?.getComputedStyle(track).transform;
|
|
818
|
+
const matrix = transform?.match(/^matrix(3d)?\(([^)]+)\)$/);
|
|
819
|
+
const offset = matrix ? Number(matrix[2].split(",")[matrix[1] ? 12 : 4]) : transform === "none" ? 0 : NaN;
|
|
820
|
+
if (!Number.isFinite(offset)) return null;
|
|
821
|
+
this.tabProgress = Math.min(Math.max(0, -offset / width), Math.max(0, this.pages().length - 1));
|
|
822
|
+
return this.tabProgress;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
private startTabProgressFrames() {
|
|
826
|
+
this.cancelTabProgressFrame();
|
|
827
|
+
if (!this.tabColorWeights() || typeof requestAnimationFrame !== "function") return;
|
|
828
|
+
const track = this.track;
|
|
829
|
+
const root = this.root;
|
|
830
|
+
const width = root?.getBoundingClientRect().width ?? 0;
|
|
831
|
+
if (!track?.isConnected || !root?.isConnected || width <= 0 || this.props.isActive === false) return;
|
|
832
|
+
const generation = this.tabProgressGeneration;
|
|
833
|
+
const selection = this.selectionRestoreToken;
|
|
834
|
+
const keys = JSON.stringify(this.pages().map(pageKey));
|
|
835
|
+
const owner = this.pageScrollElement(this.state.selectedPage);
|
|
836
|
+
const sample = () => {
|
|
837
|
+
if (generation !== this.tabProgressGeneration || this.disposed) return;
|
|
838
|
+
this.tabProgressFrame = null;
|
|
839
|
+
if (this.track !== track || this.root !== root || !track.isConnected || !root.isConnected ||
|
|
840
|
+
this.props.isActive === false || selection !== this.selectionRestoreToken ||
|
|
841
|
+
keys !== JSON.stringify(this.pages().map(pageKey)) || owner !== this.pageScrollElement(this.state.selectedPage) ||
|
|
842
|
+
width !== root.getBoundingClientRect().width || !this.tabColorWeights()) {
|
|
843
|
+
this.cancelTabProgressFrame();
|
|
844
|
+
this.readTabProgress();
|
|
845
|
+
this.syncTabColors();
|
|
846
|
+
if (this.transitionTimer !== null) this.startTabProgressFrames();
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
this.readTabProgress();
|
|
850
|
+
this.syncTabColors();
|
|
851
|
+
if (this.transitionTimer !== null) this.tabProgressFrame = requestAnimationFrame(sample);
|
|
852
|
+
};
|
|
853
|
+
sample();
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
private tabColorWeights() {
|
|
857
|
+
const config = this.props.nativeTabBar;
|
|
858
|
+
if (!config?.controlled || config.style?.variant !== "text" || this.tabProgress === null) return null;
|
|
859
|
+
const keys: string[] = [];
|
|
860
|
+
React.Children.forEach(this.props.children, child => {
|
|
861
|
+
if (child !== null && child !== undefined && typeof child !== "boolean") keys.push(pageKey(child, keys.length));
|
|
862
|
+
});
|
|
863
|
+
const itemKeys = config.items.map(item => item.key);
|
|
864
|
+
if (!keys.length || !keys.includes(config.selectedKey ?? "") || new Set(keys).size !== keys.length ||
|
|
865
|
+
new Set(itemKeys).size !== itemKeys.length || keys.some(key => !itemKeys.includes(key))) return null;
|
|
866
|
+
const progress = Math.min(Math.max(0, this.tabProgress), keys.length - 1);
|
|
867
|
+
const source = Math.floor(progress);
|
|
868
|
+
const destination = Math.min(source + 1, keys.length - 1);
|
|
869
|
+
const fraction = progress - source;
|
|
870
|
+
return new Map(keys.map((key, index) => [key, index === source ? 1 - fraction : index === destination ? fraction : 0]));
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
private tabFontOwnerKey(weights: Map<string, number> | null) {
|
|
874
|
+
const config = this.props.nativeTabBar;
|
|
875
|
+
const semantic = config?.controlled ? config.selectedKey : config?.items[this.state.selectedPage]?.key;
|
|
876
|
+
if (!weights || this.tabProgress === null) return semantic;
|
|
877
|
+
const keys = Array.from(weights.keys());
|
|
878
|
+
const progress = Math.min(Math.max(0, this.tabProgress), keys.length - 1);
|
|
879
|
+
return keys[Math.floor(progress + 0.5)];
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
private tabColor(selected: boolean, weight: number | undefined) {
|
|
883
|
+
const style = this.props.nativeTabBar?.style;
|
|
884
|
+
const active = style?.activeTextColor ?? "#000000";
|
|
885
|
+
const inactive = style?.inactiveTextColor ?? "#666666";
|
|
886
|
+
if (weight === undefined) return String(selected ? active : inactive);
|
|
887
|
+
if (weight <= 0) return String(inactive);
|
|
888
|
+
if (weight >= 1) return String(active);
|
|
889
|
+
const first = processColor(inactive);
|
|
890
|
+
const last = processColor(active);
|
|
891
|
+
if (typeof first !== "number" || typeof last !== "number") return String(selected ? active : inactive);
|
|
892
|
+
const channel = (shift: number) => ((first >>> shift) & 255) * (1 - weight) + ((last >>> shift) & 255) * weight;
|
|
893
|
+
return `rgba(${Math.round(channel(16))}, ${Math.round(channel(8))}, ${Math.round(channel(0))}, ${(channel(24) / 255).toFixed(4)})`;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
private syncTabColors() {
|
|
897
|
+
const weights = this.tabColorWeights();
|
|
898
|
+
const config = this.props.nativeTabBar;
|
|
899
|
+
if (!config) return;
|
|
900
|
+
const selectedKey = config.controlled ? config.selectedKey : config.items[this.state.selectedPage]?.key;
|
|
901
|
+
const fontOwnerKey = this.tabFontOwnerKey(weights);
|
|
902
|
+
for (const [key, button] of this.tabButtons) {
|
|
903
|
+
const fontSelected = key === fontOwnerKey;
|
|
904
|
+
button.style.color = this.tabColor(key === selectedKey, weights ? weights.get(key) ?? 0 : undefined);
|
|
905
|
+
button.style.fontWeight = config.style?.variant === "text" && fontSelected ? "600" : "500";
|
|
906
|
+
const fontFamily = (fontSelected ? config.style?.activeFontFamily ?? config.style?.fontFamily : config.style?.fontFamily) ?? "";
|
|
907
|
+
if (config.controlled && config.style?.variant === "text") {
|
|
908
|
+
button.style.fontFamily = config.style?.fontFamily ?? "";
|
|
909
|
+
const label = button.querySelector<HTMLElement>(".ok-pager-tab-label");
|
|
910
|
+
if (label) label.style.fontFamily = fontFamily;
|
|
911
|
+
} else button.style.fontFamily = fontFamily;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
754
915
|
private pageScrollElement(index: number) {
|
|
755
916
|
const pageHost = this.pageHosts.get(index);
|
|
756
917
|
return (
|
|
@@ -773,7 +934,10 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
773
934
|
this.root?.removeEventListener("touchend", this.onOverlayTouchEnd);
|
|
774
935
|
this.root?.removeEventListener("touchcancel", this.onOverlayTouchEnd);
|
|
775
936
|
this.overlayTouch = null;
|
|
937
|
+
if (this.root) this.chromeObserver?.unobserve(this.root);
|
|
776
938
|
this.root = root;
|
|
939
|
+
if (root) this.chromeObserver?.observe(root);
|
|
940
|
+
else this.suspendToolbar();
|
|
777
941
|
root?.addEventListener(
|
|
778
942
|
"ok-collapsible-pager-scroll-key-changed",
|
|
779
943
|
this.onScrollOwnerIdentityChanged
|
|
@@ -1174,10 +1338,14 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1174
1338
|
this.savePageOffset(this.state.selectedPage);
|
|
1175
1339
|
|
|
1176
1340
|
if (animated) this.beginPageTransition();
|
|
1177
|
-
else
|
|
1341
|
+
else {
|
|
1342
|
+
this.finishPageTransition();
|
|
1343
|
+
this.tabProgress = position;
|
|
1344
|
+
}
|
|
1178
1345
|
this.setState(
|
|
1179
1346
|
{ selectedPage: position, animateTransition: animated },
|
|
1180
1347
|
() => {
|
|
1348
|
+
if (animated) this.startTabProgressFrames();
|
|
1181
1349
|
this.scheduleScrollConfiguration();
|
|
1182
1350
|
const restore = () => {
|
|
1183
1351
|
if (
|
|
@@ -1277,6 +1445,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1277
1445
|
this.cancelPendingTopFrame();
|
|
1278
1446
|
this.horizontalTouch = true;
|
|
1279
1447
|
this.emitPageScrollState("dragging");
|
|
1448
|
+
this.suspendToolbar();
|
|
1280
1449
|
}
|
|
1281
1450
|
};
|
|
1282
1451
|
|
|
@@ -1321,9 +1490,318 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1321
1490
|
if (wasHorizontal) this.finishPageTransition();
|
|
1322
1491
|
};
|
|
1323
1492
|
|
|
1493
|
+
private toolbarSlot: HTMLDivElement | null = null;
|
|
1494
|
+
private toolbarButton: HTMLButtonElement | null = null;
|
|
1495
|
+
private toolbarOwnerKey: string | undefined;
|
|
1496
|
+
private toolbarOwnerEntry: CollapsiblePagerToolbarItem | undefined;
|
|
1497
|
+
private toolbarIconIdentity = "";
|
|
1498
|
+
private toolbarLoadedIcon: SVGSVGElement | null = null;
|
|
1499
|
+
private toolbarPendingIdentity = "";
|
|
1500
|
+
private toolbarReadyIcon: SVGSVGElement | null = null;
|
|
1501
|
+
private toolbarFailedIdentity = "";
|
|
1502
|
+
private toolbarAnimation: Animation | null = null;
|
|
1503
|
+
private toolbarPresence = false;
|
|
1504
|
+
private toolbarPresenceInterrupted = false;
|
|
1505
|
+
private toolbarImage: HTMLImageElement | null = null;
|
|
1506
|
+
private toolbarGeneration = 0;
|
|
1507
|
+
private toolbarTouchKey: string | null | undefined;
|
|
1508
|
+
|
|
1509
|
+
private ownsSettledToolbar() {
|
|
1510
|
+
return this.props.nativeTabBar?.controlled === true && this.props.nativeTabBar.toolbar !== undefined;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
private toolbarCanCommit() {
|
|
1514
|
+
if (!this.ownsSettledToolbar()) return true;
|
|
1515
|
+
if (this.disposed || this.props.isActive === false || this.horizontalTouch ||
|
|
1516
|
+
this.transitionTimer !== null || this.pageScrollState !== "idle" || !this.root?.isConnected) return false;
|
|
1517
|
+
const actual = this.readTabProgress();
|
|
1518
|
+
if (actual === null || Math.abs(actual - this.state.selectedPage) > 0.001) return false;
|
|
1519
|
+
const config = this.props.nativeTabBar!;
|
|
1520
|
+
const keys: string[] = [];
|
|
1521
|
+
React.Children.forEach(this.props.children, child => {
|
|
1522
|
+
if (child !== null && child !== undefined && typeof child !== "boolean") keys.push(pageKey(child, keys.length));
|
|
1523
|
+
});
|
|
1524
|
+
const itemKeys = config.items.map(item => item.key);
|
|
1525
|
+
const valid = keys.length > 0 && new Set(keys).size === keys.length &&
|
|
1526
|
+
new Set(itemKeys).size === itemKeys.length && keys.every(key => itemKeys.includes(key));
|
|
1527
|
+
return !valid || !keys.includes(config.selectedKey ?? "") || keys[this.state.selectedPage] === config.selectedKey;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
private cancelToolbarPending() {
|
|
1531
|
+
if (this.toolbarPendingIdentity || this.toolbarImage || this.toolbarReadyIcon) this.toolbarGeneration += 1;
|
|
1532
|
+
if (this.toolbarImage) this.toolbarImage.onload = this.toolbarImage.onerror = null;
|
|
1533
|
+
this.toolbarImage = null;
|
|
1534
|
+
this.toolbarPendingIdentity = "";
|
|
1535
|
+
this.toolbarReadyIcon = null;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
private setToolbarInteractive(enabled: boolean) {
|
|
1539
|
+
const button = this.toolbarButton;
|
|
1540
|
+
if (!button) return;
|
|
1541
|
+
if (!enabled) {
|
|
1542
|
+
if (button.ownerDocument.activeElement === button) button.blur();
|
|
1543
|
+
if (this.toolbarTouchKey !== undefined) this.toolbarTouchKey = null;
|
|
1544
|
+
}
|
|
1545
|
+
button.disabled = !enabled;
|
|
1546
|
+
button.style.pointerEvents = enabled ? "auto" : "none";
|
|
1547
|
+
button.tabIndex = enabled ? 0 : -1;
|
|
1548
|
+
button.setAttribute("aria-hidden", String(!enabled));
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
private suspendToolbar() {
|
|
1552
|
+
if (!this.ownsSettledToolbar()) return;
|
|
1553
|
+
this.setToolbarInteractive(false);
|
|
1554
|
+
this.cancelToolbarPending();
|
|
1555
|
+
if (this.toolbarAnimation && this.toolbarButton) {
|
|
1556
|
+
const opacity = this.toolbarButton.ownerDocument.defaultView?.getComputedStyle(this.toolbarButton).opacity;
|
|
1557
|
+
this.toolbarAnimation.cancel();
|
|
1558
|
+
this.toolbarAnimation = null;
|
|
1559
|
+
this.toolbarButton.style.opacity = opacity || this.toolbarButton.style.opacity;
|
|
1560
|
+
this.toolbarPresenceInterrupted = true;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
private setToolbarSlot = (slot: HTMLDivElement | null) => {
|
|
1565
|
+
if (this.toolbarSlot === slot) return;
|
|
1566
|
+
this.toolbarAnimation?.cancel();
|
|
1567
|
+
this.toolbarAnimation = null;
|
|
1568
|
+
this.cancelToolbarPending();
|
|
1569
|
+
this.toolbarGeneration += 1;
|
|
1570
|
+
this.toolbarButton?.remove();
|
|
1571
|
+
this.toolbarButton = null;
|
|
1572
|
+
this.toolbarOwnerKey = undefined;
|
|
1573
|
+
this.toolbarOwnerEntry = undefined;
|
|
1574
|
+
this.toolbarIconIdentity = "";
|
|
1575
|
+
this.toolbarLoadedIcon = null;
|
|
1576
|
+
this.toolbarFailedIdentity = "";
|
|
1577
|
+
this.toolbarPresence = false;
|
|
1578
|
+
this.toolbarPresenceInterrupted = false;
|
|
1579
|
+
this.toolbarTouchKey = null;
|
|
1580
|
+
this.toolbarSlot = slot;
|
|
1581
|
+
if (slot) this.syncToolbar();
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
private animateToolbar(visible: boolean) {
|
|
1585
|
+
const button = this.toolbarButton;
|
|
1586
|
+
if (!button || (this.toolbarPresence === visible && !this.toolbarPresenceInterrupted)) return;
|
|
1587
|
+
this.toolbarPresenceInterrupted = false;
|
|
1588
|
+
this.toolbarPresence = visible;
|
|
1589
|
+
const current = button.ownerDocument.defaultView?.getComputedStyle(button).opacity ?? button.style.opacity;
|
|
1590
|
+
this.toolbarAnimation?.cancel();
|
|
1591
|
+
this.toolbarAnimation = null;
|
|
1592
|
+
button.style.opacity = visible ? "1" : "0";
|
|
1593
|
+
const finish = () => {
|
|
1594
|
+
button.hidden = !visible;
|
|
1595
|
+
if (!visible && !this.toolbarOwnerKey && this.toolbarButton === button) {
|
|
1596
|
+
button.remove();
|
|
1597
|
+
this.toolbarButton = null;
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
if (typeof button.animate !== "function") { finish(); return; }
|
|
1601
|
+
button.hidden = false;
|
|
1602
|
+
const animation = button.animate([{ opacity: current || "0" }, { opacity: visible ? "1" : "0" }], { duration: 100, fill: "forwards" });
|
|
1603
|
+
this.toolbarAnimation = animation;
|
|
1604
|
+
animation.onfinish = () => {
|
|
1605
|
+
if (this.toolbarAnimation !== animation || this.toolbarButton !== button || this.toolbarPresence !== visible) return;
|
|
1606
|
+
animation.cancel();
|
|
1607
|
+
this.toolbarAnimation = null;
|
|
1608
|
+
finish();
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
private hideToolbar(failed: boolean) {
|
|
1613
|
+
this.setToolbarInteractive(false);
|
|
1614
|
+
this.toolbarOwnerKey = undefined;
|
|
1615
|
+
this.toolbarOwnerEntry = undefined;
|
|
1616
|
+
this.toolbarButton?.removeAttribute("data-testid");
|
|
1617
|
+
this.toolbarButton?.removeAttribute("aria-label");
|
|
1618
|
+
if (failed) this.toolbarButton?.replaceChildren();
|
|
1619
|
+
this.animateToolbar(false);
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
private commitToolbar(key: string, entry: CollapsiblePagerToolbarItem, icon: SVGSVGElement, identity: string) {
|
|
1623
|
+
const button = this.toolbarButton;
|
|
1624
|
+
if (!button || !this.toolbarCanCommit()) return;
|
|
1625
|
+
if (this.toolbarOwnerKey !== key && this.toolbarTouchKey !== undefined) this.toolbarTouchKey = null;
|
|
1626
|
+
const size = Math.min(128, Math.max(1, entry.size ?? 38));
|
|
1627
|
+
const iconSize = Math.min(size, Math.max(1, entry.iconSize ?? 24));
|
|
1628
|
+
const contentWidth = Math.min(size, Math.max(0, entry.contentWidth ?? 24));
|
|
1629
|
+
const trailingInset = Math.min(128, Math.max(0, entry.trailingInset ?? 20));
|
|
1630
|
+
if (button.firstChild !== icon) button.replaceChildren(icon);
|
|
1631
|
+
Object.assign(button.style, { position: "absolute", width: `${size}px`, height: `${size}px`, borderRadius: "50%", top: "50%", transform: "translateY(-50%)",
|
|
1632
|
+
insetInlineEnd: `${trailingInset - (size - contentWidth) / 2}px`, padding: `${(size - iconSize) / 2}px`, color: entry.iconColor ?? "#000000" });
|
|
1633
|
+
const base = entry.selected ? entry.selectedBackgroundColor ?? "transparent" : "transparent";
|
|
1634
|
+
button.style.setProperty("--pager-toolbar-base", base);
|
|
1635
|
+
button.style.setProperty("--pager-toolbar-hover", entry.hoverBackgroundColor ?? base);
|
|
1636
|
+
button.style.setProperty("--pager-toolbar-pressed", entry.pressedBackgroundColor ?? base);
|
|
1637
|
+
button.setAttribute("aria-label", entry.accessibilityLabel ?? "");
|
|
1638
|
+
if (entry.testID) button.setAttribute("data-testid", entry.testID); else button.removeAttribute("data-testid");
|
|
1639
|
+
this.toolbarOwnerKey = key;
|
|
1640
|
+
this.toolbarOwnerEntry = { ...entry };
|
|
1641
|
+
this.toolbarIconIdentity = identity;
|
|
1642
|
+
this.toolbarLoadedIcon = icon;
|
|
1643
|
+
this.toolbarPendingIdentity = "";
|
|
1644
|
+
this.toolbarReadyIcon = null;
|
|
1645
|
+
this.toolbarImage = null;
|
|
1646
|
+
this.animateToolbar(true);
|
|
1647
|
+
this.setToolbarInteractive(true);
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
private syncToolbar() {
|
|
1651
|
+
const slot = this.toolbarSlot;
|
|
1652
|
+
if (!slot) return;
|
|
1653
|
+
if (!this.toolbarCanCommit()) { this.suspendToolbar(); return; }
|
|
1654
|
+
const config = this.props.nativeTabBar;
|
|
1655
|
+
const key = config?.controlled ? config.selectedKey : config?.items[this.state.selectedPage]?.key;
|
|
1656
|
+
const entry = key ? config?.toolbar?.[key] : undefined;
|
|
1657
|
+
if (!entry?.iconName || !key) {
|
|
1658
|
+
this.cancelToolbarPending();
|
|
1659
|
+
this.hideToolbar(false);
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
let button = this.toolbarButton;
|
|
1663
|
+
if (!button) {
|
|
1664
|
+
button = slot.ownerDocument.createElement("button");
|
|
1665
|
+
button.type = "button";
|
|
1666
|
+
button.className = "ok-pager-toolbar";
|
|
1667
|
+
button.style.opacity = "0";
|
|
1668
|
+
button.hidden = true;
|
|
1669
|
+
button.disabled = true;
|
|
1670
|
+
button.addEventListener("pointerdown", () => { this.toolbarTouchKey = button!.disabled ? null : this.toolbarOwnerKey ?? null; });
|
|
1671
|
+
button.addEventListener("pointercancel", () => { this.toolbarTouchKey = null; });
|
|
1672
|
+
button.onclick = event => {
|
|
1673
|
+
if (this.toolbarButton !== event.currentTarget) return;
|
|
1674
|
+
const pointer = event.detail !== 0;
|
|
1675
|
+
const touched = this.toolbarTouchKey;
|
|
1676
|
+
if (pointer) this.toolbarTouchKey = undefined;
|
|
1677
|
+
const current = this.props.nativeTabBar;
|
|
1678
|
+
const semantic = current?.controlled ? current.selectedKey : current?.items[this.state.selectedPage]?.key;
|
|
1679
|
+
const owner = this.toolbarOwnerKey;
|
|
1680
|
+
if (button!.disabled || !this.toolbarCanCommit() || !owner || owner !== semantic ||
|
|
1681
|
+
!this.toolbarOwnerEntry || (pointer && touched !== owner)) return;
|
|
1682
|
+
const rect = button!.getBoundingClientRect();
|
|
1683
|
+
this.props.onNativeToolbarPress?.({ nativeEvent: { key: owner,
|
|
1684
|
+
anchorRect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height } } } as ReactNative.NativeSyntheticEvent<CollapsiblePagerToolbarPress>);
|
|
1685
|
+
};
|
|
1686
|
+
slot.appendChild(button);
|
|
1687
|
+
this.toolbarButton = button;
|
|
1688
|
+
this.toolbarPresence = false;
|
|
1689
|
+
}
|
|
1690
|
+
const size = Math.min(128, Math.max(1, entry.size ?? 38));
|
|
1691
|
+
const iconSize = Math.min(size, Math.max(1, entry.iconSize ?? 24));
|
|
1692
|
+
const identity = `${entry.iconName}|${entry.iconColor ?? "#000000"}|${iconSize}`;
|
|
1693
|
+
if (identity === this.toolbarIconIdentity && this.toolbarLoadedIcon) {
|
|
1694
|
+
this.cancelToolbarPending();
|
|
1695
|
+
this.commitToolbar(key, entry, this.toolbarLoadedIcon, identity);
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
if (identity === this.toolbarPendingIdentity) {
|
|
1699
|
+
if (this.toolbarReadyIcon) this.commitToolbar(key, entry, this.toolbarReadyIcon, identity);
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
this.cancelToolbarPending();
|
|
1703
|
+
this.setToolbarInteractive(false);
|
|
1704
|
+
this.toolbarPendingIdentity = identity;
|
|
1705
|
+
if (identity === this.toolbarFailedIdentity) { this.hideToolbar(true); return; }
|
|
1706
|
+
const generation = ++this.toolbarGeneration;
|
|
1707
|
+
const icon = createNamedIcon(button.ownerDocument, entry.iconName);
|
|
1708
|
+
icon.setAttribute("width", String(iconSize)); icon.setAttribute("height", String(iconSize));
|
|
1709
|
+
const use = icon.querySelector("use");
|
|
1710
|
+
const fail = () => {
|
|
1711
|
+
if (this.toolbarGeneration !== generation || this.toolbarPendingIdentity !== identity) return;
|
|
1712
|
+
this.toolbarImage = null;
|
|
1713
|
+
this.toolbarFailedIdentity = identity;
|
|
1714
|
+
this.hideToolbar(true);
|
|
1715
|
+
};
|
|
1716
|
+
if (!use) { fail(); return; }
|
|
1717
|
+
const ready = () => {
|
|
1718
|
+
if (this.disposed || this.toolbarGeneration !== generation || this.toolbarPendingIdentity !== identity) return;
|
|
1719
|
+
this.toolbarImage = null;
|
|
1720
|
+
this.toolbarReadyIcon = icon;
|
|
1721
|
+
this.syncToolbar();
|
|
1722
|
+
};
|
|
1723
|
+
const href = use.getAttribute("href") ?? use.getAttribute("xlink:href") ?? "";
|
|
1724
|
+
const view = button.ownerDocument.defaultView;
|
|
1725
|
+
if (view?.Image && href.split("#")[0]) {
|
|
1726
|
+
const image = new view.Image();
|
|
1727
|
+
this.toolbarImage = image;
|
|
1728
|
+
image.onload = ready;
|
|
1729
|
+
image.onerror = fail;
|
|
1730
|
+
image.src = href.split("#")[0];
|
|
1731
|
+
} else ready();
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
private renderNativeTabBar() {
|
|
1735
|
+
const config = this.props.nativeTabBar;
|
|
1736
|
+
if (!config?.items.length || (config.style?.variant !== "text" && config.controlled !== true && config.toolbar === undefined)) return null;
|
|
1737
|
+
const style = config.style;
|
|
1738
|
+
const variant = style?.variant ?? "underline";
|
|
1739
|
+
const selectedKey = config.controlled ? config.selectedKey : config.items[this.state.selectedPage]?.key;
|
|
1740
|
+
const toolbarEntries = config.toolbar === undefined ? undefined : Object.values(config.toolbar);
|
|
1741
|
+
const reservedWidth = toolbarEntries === undefined ? 0 : toolbarEntries.length === 0 ? 44 : Math.max(...toolbarEntries.map(entry => {
|
|
1742
|
+
const size = Math.min(128, Math.max(1, entry.size ?? 38));
|
|
1743
|
+
return Math.min(size, Math.max(0, entry.contentWidth ?? 24)) + Math.min(128, Math.max(0, entry.trailingInset ?? 20));
|
|
1744
|
+
}));
|
|
1745
|
+
const segmented = variant === "segmented";
|
|
1746
|
+
const reserveTextFaces = config.controlled && variant === "text";
|
|
1747
|
+
const colorWeights = this.tabColorWeights();
|
|
1748
|
+
const fontOwnerKey = this.tabFontOwnerKey(colorWeights);
|
|
1749
|
+
return React.createElement("div", {
|
|
1750
|
+
className: "ok-pager-tab-bar",
|
|
1751
|
+
dir: this.props.layoutDirection === "rtl" || ((this.props.layoutDirection ?? "locale") === "locale" && I18nManager.isRTL) ? "rtl" : "ltr",
|
|
1752
|
+
style: { display: "flex", alignItems: "center", position: "relative", height: style?.height ?? 44,
|
|
1753
|
+
backgroundColor: String(style?.backgroundColor ?? "transparent"), minWidth: 0 },
|
|
1754
|
+
},
|
|
1755
|
+
React.createElement("style", null, `.ok-pager-tab{box-sizing:border-box;appearance:none;border:0;background:transparent;cursor:default;white-space:nowrap;flex-shrink:0;line-height:normal}.ok-pager-toolbar{box-sizing:border-box;appearance:none;border:1px solid transparent;cursor:default;display:flex;align-items:center;justify-content:center;background:var(--pager-toolbar-base)}.ok-pager-toolbar:hover:enabled{background:var(--pager-toolbar-hover)}.ok-pager-toolbar:active:enabled{background:var(--pager-toolbar-pressed)}`),
|
|
1756
|
+
React.createElement("div", { role: "tablist", style: { display: "flex", overflowX: segmented ? "hidden" : "auto", flex: 1,
|
|
1757
|
+
padding: `${style?.contentPaddingVertical ?? 0}px ${style?.contentPaddingHorizontal ?? 20}px`, gap: style?.itemSpacing ?? 8 } },
|
|
1758
|
+
...config.items.map((item, position) => {
|
|
1759
|
+
const selected = item.key === selectedKey;
|
|
1760
|
+
const fontSelected = item.key === fontOwnerKey;
|
|
1761
|
+
return React.createElement("button", {
|
|
1762
|
+
key: item.key, role: "tab", type: "button", className: "ok-pager-tab", "aria-selected": selected,
|
|
1763
|
+
ref: (button: HTMLButtonElement | null) => { if (button) this.tabButtons.set(item.key, button); else this.tabButtons.delete(item.key); },
|
|
1764
|
+
"aria-label": item.accessibilityLabel ?? item.title, "data-testid": item.testID,
|
|
1765
|
+
style: { padding: variant === "text" ? "6px 10px" : "6px 8px", minWidth: 44, height: (style?.height ?? 44) - 2 * (style?.contentPaddingVertical ?? 0),
|
|
1766
|
+
fontSize: style?.fontSize ?? (variant === "text" ? 18 : 16),
|
|
1767
|
+
fontWeight: variant === "text" && fontSelected ? 600 : 500,
|
|
1768
|
+
fontFamily: reserveTextFaces ? style?.fontFamily : fontSelected ? style?.activeFontFamily ?? style?.fontFamily : style?.fontFamily,
|
|
1769
|
+
display: reserveTextFaces ? "inline-grid" : undefined,
|
|
1770
|
+
gridTemplateAreas: reserveTextFaces ? '"label"' : undefined,
|
|
1771
|
+
alignItems: reserveTextFaces ? "center" : undefined,
|
|
1772
|
+
color: this.tabColor(selected, colorWeights ? colorWeights.get(item.key) ?? 0 : undefined),
|
|
1773
|
+
flex: segmented ? 1 : undefined, borderRadius: segmented ? 999 : 0,
|
|
1774
|
+
backgroundColor: segmented && selected ? String(style?.indicatorColor ?? "transparent") : "transparent",
|
|
1775
|
+
borderBottom: variant === "underline" && selected ? `${style?.indicatorHeight ?? 2}px solid ${String(style?.indicatorColor ?? "#000000")}` : undefined },
|
|
1776
|
+
onClick: () => {
|
|
1777
|
+
if (!config.controlled) {
|
|
1778
|
+
const animated = this.props.nativeTabPressAnimationEnabled ?? Math.abs(position - this.state.selectedPage) <= 1;
|
|
1779
|
+
if (animated) this.setPage(position); else this.setPageWithoutAnimation(position);
|
|
1780
|
+
}
|
|
1781
|
+
this.props.onNativeTabPress?.({ nativeEvent: { position, key: item.key } } as CollapsiblePagerViewOnNativeTabPressEvent);
|
|
1782
|
+
},
|
|
1783
|
+
}, reserveTextFaces ? [
|
|
1784
|
+
React.createElement("span", { key: "label", className: "ok-pager-tab-label", style: {
|
|
1785
|
+
gridArea: "label", fontFamily: fontSelected ? style?.activeFontFamily ?? style?.fontFamily : style?.fontFamily,
|
|
1786
|
+
} }, item.title),
|
|
1787
|
+
...[false, true].map(active => React.createElement("span", {
|
|
1788
|
+
key: active ? "active-width" : "normal-width", "aria-hidden": true,
|
|
1789
|
+
style: { gridArea: "label", visibility: "hidden", pointerEvents: "none", userSelect: "none",
|
|
1790
|
+
fontWeight: active ? 600 : 500,
|
|
1791
|
+
fontFamily: active ? style?.activeFontFamily ?? style?.fontFamily : style?.fontFamily },
|
|
1792
|
+
}, item.title)),
|
|
1793
|
+
] : item.title);
|
|
1794
|
+
})),
|
|
1795
|
+
config.toolbar !== undefined ? React.createElement("div", { ref: this.setToolbarSlot, className: "ok-pager-toolbar-slot", style: { flexShrink: 0, width: reservedWidth, height: "100%", position: "relative" } }) : null);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1324
1798
|
render() {
|
|
1325
1799
|
const {
|
|
1326
1800
|
children: _children,
|
|
1801
|
+
nativeTabBar: _nativeTabBar,
|
|
1802
|
+
nativeTabPressAnimationEnabled: _nativeTabPressAnimationEnabled,
|
|
1803
|
+
onNativeTabPress: _onNativeTabPress,
|
|
1804
|
+
onNativeToolbarPress: _onNativeToolbarPress,
|
|
1327
1805
|
header,
|
|
1328
1806
|
stickyHeader,
|
|
1329
1807
|
topOverlay: _topOverlay,
|
|
@@ -1332,6 +1810,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1332
1810
|
externalTopOverlayTag: _externalTopOverlayTag,
|
|
1333
1811
|
headerHeight: _headerHeight,
|
|
1334
1812
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
1813
|
+
stickyHeaderHeights: _stickyHeaderHeights,
|
|
1335
1814
|
isActive: _isActive,
|
|
1336
1815
|
pageRetentionDistance: _pageRetentionDistance,
|
|
1337
1816
|
layoutDirection: _layoutDirection,
|
|
@@ -1419,8 +1898,8 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1419
1898
|
collapseAnimation,
|
|
1420
1899
|
]}
|
|
1421
1900
|
>
|
|
1422
|
-
{this.hasExplicitStickyHeaderHeight ? stickyHeader : (
|
|
1423
|
-
<View ref={this.setStickyContent}>{stickyHeader}</View>
|
|
1901
|
+
{this.hasExplicitStickyHeaderHeight ? <>{this.renderNativeTabBar()}{stickyHeader}</> : (
|
|
1902
|
+
<View ref={this.setStickyContent}>{this.renderNativeTabBar()}{stickyHeader}</View>
|
|
1424
1903
|
)}
|
|
1425
1904
|
</View>
|
|
1426
1905
|
<View
|