@onekeyfe/react-native-pager-view 6.7.0-3 → 6.7.0-30
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,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createNamedIcon } from "@onekeyfe/react-native-image/icon/dom";
|
|
5
|
+
import { I18nManager, Platform, processColor, StyleSheet, View } from "react-native";
|
|
5
6
|
import { WebCollapsiblePagerPage } from "./WebCollapsiblePagerPage.js";
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
const COLLAPSE_ANIMATION_NAME = "ok-collapsible-pager-collapse";
|
|
8
9
|
const COLLAPSE_STYLE_ID = "ok-collapsible-pager-styles";
|
|
9
10
|
const PAGER_HEADER_INSET = "--ok-collapsible-pager-header-inset";
|
|
@@ -48,6 +49,10 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
48
49
|
};
|
|
49
50
|
root = null;
|
|
50
51
|
track = null;
|
|
52
|
+
tabProgress = null;
|
|
53
|
+
tabProgressFrame = null;
|
|
54
|
+
tabProgressGeneration = 0;
|
|
55
|
+
tabButtons = new Map();
|
|
51
56
|
headerSlot = null;
|
|
52
57
|
stickySlot = null;
|
|
53
58
|
cssTimelineSupported = false;
|
|
@@ -80,6 +85,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
80
85
|
configureFrame = null;
|
|
81
86
|
pendingTopFrame = null;
|
|
82
87
|
transitionTimer = null;
|
|
88
|
+
transitionGeneration = 0;
|
|
83
89
|
pageScrollState = "idle";
|
|
84
90
|
configuredScrollElement = null;
|
|
85
91
|
timelineName = `--ok-collapsible-pager-${++collapsiblePagerWebInstance}`;
|
|
@@ -115,6 +121,9 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
115
121
|
this.scheduleScrollConfiguration();
|
|
116
122
|
this.syncFallbackHeader();
|
|
117
123
|
this.notifyMountedPagesChanged();
|
|
124
|
+
this.syncToolbar();
|
|
125
|
+
this.tabProgress = this.state.selectedPage;
|
|
126
|
+
this.syncTabColors();
|
|
118
127
|
this.emitDiagnostics("mounted");
|
|
119
128
|
}
|
|
120
129
|
componentDidUpdate(previousProps, _previousState, routeSnapshot) {
|
|
@@ -166,12 +175,17 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
166
175
|
this.scheduleScrollConfiguration();
|
|
167
176
|
this.syncFallbackHeader();
|
|
168
177
|
this.notifyMountedPagesChanged();
|
|
178
|
+
this.syncToolbar();
|
|
179
|
+
if (previousProps.isActive === false && this.props.isActive !== false) this.readTabProgress();
|
|
180
|
+
if (this.props.isActive === false || !this.tabColorWeights()) this.cancelTabProgressFrame();
|
|
181
|
+
this.syncTabColors();
|
|
169
182
|
}
|
|
170
183
|
componentWillUnmount() {
|
|
171
184
|
// Activity can disconnect effects before the inactive update commits.
|
|
172
185
|
const routeTarget = this.captureRouteTarget(this.props);
|
|
173
186
|
if (routeTarget) this.setRouteTarget(routeTarget);
|
|
174
187
|
this.disposed = true;
|
|
188
|
+
this.setToolbarSlot(null);
|
|
175
189
|
this.selectionRestoreToken += 1;
|
|
176
190
|
this.cancelPendingTopFrame();
|
|
177
191
|
this.savePageOffset(this.state.selectedPage);
|
|
@@ -214,6 +228,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
214
228
|
};
|
|
215
229
|
observeChrome() {
|
|
216
230
|
this.chromeObserver = new ResizeObserver(this.scheduleChromeMeasurement);
|
|
231
|
+
if (this.root) this.chromeObserver.observe(this.root);
|
|
217
232
|
if (this.headerContent) this.chromeObserver.observe(this.headerContent);
|
|
218
233
|
if (this.stickyContent) this.chromeObserver.observe(this.stickyContent);
|
|
219
234
|
this.scheduleChromeMeasurement();
|
|
@@ -232,6 +247,8 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
232
247
|
this.measuredStickyHeight = nextSticky;
|
|
233
248
|
this.headerMeasured = Boolean(header?.isConnected);
|
|
234
249
|
this.stickyMeasured = Boolean(sticky?.isConnected);
|
|
250
|
+
this.syncToolbar();
|
|
251
|
+
this.syncTabColors();
|
|
235
252
|
if (headerChanged || stickyChanged) {
|
|
236
253
|
this.forceUpdate();
|
|
237
254
|
this.scheduleScrollConfiguration();
|
|
@@ -335,6 +352,15 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
335
352
|
scrollToPageTop = options => {
|
|
336
353
|
this.scrollCurrentPageToTop(0, options?.animated ?? true);
|
|
337
354
|
};
|
|
355
|
+
scrollHeaderBy = delta => {
|
|
356
|
+
if (!Number.isFinite(delta)) return;
|
|
357
|
+
const offset = Math.min(this.headerHeight, Math.max(0, this.sharedHeaderOffset + delta));
|
|
358
|
+
this.scrollCurrentPageToTop(offset, false);
|
|
359
|
+
};
|
|
360
|
+
scrollHeaderToOffset = offset => {
|
|
361
|
+
if (!Number.isFinite(offset)) return;
|
|
362
|
+
this.scrollCurrentPageToTop(Math.min(this.headerHeight, Math.max(0, offset)), false);
|
|
363
|
+
};
|
|
338
364
|
scrollToStickyTop = options => {
|
|
339
365
|
this.scrollCurrentPageToTop(this.headerHeight, options?.animated ?? true);
|
|
340
366
|
};
|
|
@@ -386,13 +412,13 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
386
412
|
this.pendingTopFrame = null;
|
|
387
413
|
if (!element.isConnected || this.horizontalTouch || this.transitionTimer !== null || this.pageScrollElement(this.state.selectedPage) !== element || this.pages().map(pageKey)[this.state.selectedPage] !== key) return;
|
|
388
414
|
this.pageOffsets.set(key, 0);
|
|
389
|
-
this.sharedHeaderOffset = offset;
|
|
415
|
+
this.sharedHeaderOffset = Math.min(this.headerHeight, Math.max(0, offset));
|
|
390
416
|
this.bodyAlignment = {
|
|
391
417
|
element,
|
|
392
418
|
key
|
|
393
419
|
};
|
|
394
420
|
scrollElementTo(element, {
|
|
395
|
-
top:
|
|
421
|
+
top: this.sharedHeaderOffset,
|
|
396
422
|
behavior: animated ? "smooth" : "instant"
|
|
397
423
|
});
|
|
398
424
|
this.syncFallbackHeader();
|
|
@@ -433,29 +459,138 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
433
459
|
}));
|
|
434
460
|
}
|
|
435
461
|
finishPageTransition = () => {
|
|
462
|
+
this.transitionGeneration += 1;
|
|
436
463
|
if (this.transitionTimer !== null) {
|
|
437
464
|
clearTimeout(this.transitionTimer);
|
|
438
465
|
this.transitionTimer = null;
|
|
439
466
|
}
|
|
467
|
+
this.readTabProgress();
|
|
468
|
+
this.cancelTabProgressFrame();
|
|
469
|
+
this.syncTabColors();
|
|
440
470
|
this.emitPageScrollState("idle");
|
|
471
|
+
this.syncToolbar();
|
|
441
472
|
};
|
|
442
473
|
beginPageTransition() {
|
|
474
|
+
this.suspendToolbar();
|
|
443
475
|
if (this.transitionTimer !== null) clearTimeout(this.transitionTimer);
|
|
476
|
+
const generation = ++this.transitionGeneration;
|
|
444
477
|
this.emitPageScrollState("settling");
|
|
445
|
-
this.transitionTimer = setTimeout(
|
|
478
|
+
this.transitionTimer = setTimeout(() => {
|
|
479
|
+
if (generation === this.transitionGeneration) this.finishPageTransition();
|
|
480
|
+
}, 320);
|
|
446
481
|
}
|
|
447
482
|
onTrackTransitionEnd = event => {
|
|
448
483
|
if (event.target === this.track && event.propertyName === "transform") {
|
|
484
|
+
this.readTabProgress();
|
|
485
|
+
if (this.tabColorWeights() && this.tabProgress !== null && Math.abs(this.tabProgress - this.state.selectedPage) > 0.001) return;
|
|
449
486
|
this.finishPageTransition();
|
|
450
487
|
}
|
|
451
488
|
};
|
|
452
489
|
setTrack = node => {
|
|
453
490
|
const track = webElement(node);
|
|
454
491
|
if (track === this.track) return;
|
|
492
|
+
this.cancelTabProgressFrame();
|
|
455
493
|
this.track?.removeEventListener("transitionend", this.onTrackTransitionEnd);
|
|
456
494
|
this.track = track;
|
|
457
495
|
this.track?.addEventListener("transitionend", this.onTrackTransitionEnd);
|
|
458
496
|
};
|
|
497
|
+
cancelTabProgressFrame() {
|
|
498
|
+
this.tabProgressGeneration += 1;
|
|
499
|
+
if (this.tabProgressFrame !== null) cancelAnimationFrame(this.tabProgressFrame);
|
|
500
|
+
this.tabProgressFrame = null;
|
|
501
|
+
}
|
|
502
|
+
readTabProgress() {
|
|
503
|
+
const track = this.track;
|
|
504
|
+
const width = this.root?.getBoundingClientRect().width ?? 0;
|
|
505
|
+
if (!track?.isConnected || width <= 0) return null;
|
|
506
|
+
const transform = track.ownerDocument.defaultView?.getComputedStyle(track).transform;
|
|
507
|
+
const matrix = transform?.match(/^matrix(3d)?\(([^)]+)\)$/);
|
|
508
|
+
const offset = matrix ? Number(matrix[2].split(",")[matrix[1] ? 12 : 4]) : transform === "none" ? 0 : NaN;
|
|
509
|
+
if (!Number.isFinite(offset)) return null;
|
|
510
|
+
this.tabProgress = Math.min(Math.max(0, -offset / width), Math.max(0, this.pages().length - 1));
|
|
511
|
+
return this.tabProgress;
|
|
512
|
+
}
|
|
513
|
+
startTabProgressFrames() {
|
|
514
|
+
this.cancelTabProgressFrame();
|
|
515
|
+
if (!this.tabColorWeights() || typeof requestAnimationFrame !== "function") return;
|
|
516
|
+
const track = this.track;
|
|
517
|
+
const root = this.root;
|
|
518
|
+
const width = root?.getBoundingClientRect().width ?? 0;
|
|
519
|
+
if (!track?.isConnected || !root?.isConnected || width <= 0 || this.props.isActive === false) return;
|
|
520
|
+
const generation = this.tabProgressGeneration;
|
|
521
|
+
const selection = this.selectionRestoreToken;
|
|
522
|
+
const keys = JSON.stringify(this.pages().map(pageKey));
|
|
523
|
+
const owner = this.pageScrollElement(this.state.selectedPage);
|
|
524
|
+
const sample = () => {
|
|
525
|
+
if (generation !== this.tabProgressGeneration || this.disposed) return;
|
|
526
|
+
this.tabProgressFrame = null;
|
|
527
|
+
if (this.track !== track || this.root !== root || !track.isConnected || !root.isConnected || this.props.isActive === false || selection !== this.selectionRestoreToken || keys !== JSON.stringify(this.pages().map(pageKey)) || owner !== this.pageScrollElement(this.state.selectedPage) || width !== root.getBoundingClientRect().width || !this.tabColorWeights()) {
|
|
528
|
+
this.cancelTabProgressFrame();
|
|
529
|
+
this.readTabProgress();
|
|
530
|
+
this.syncTabColors();
|
|
531
|
+
if (this.transitionTimer !== null) this.startTabProgressFrames();
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
this.readTabProgress();
|
|
535
|
+
this.syncTabColors();
|
|
536
|
+
if (this.transitionTimer !== null) this.tabProgressFrame = requestAnimationFrame(sample);
|
|
537
|
+
};
|
|
538
|
+
sample();
|
|
539
|
+
}
|
|
540
|
+
tabColorWeights() {
|
|
541
|
+
const config = this.props.nativeTabBar;
|
|
542
|
+
if (!config?.controlled || config.style?.variant !== "text" || this.tabProgress === null) return null;
|
|
543
|
+
const keys = [];
|
|
544
|
+
React.Children.forEach(this.props.children, child => {
|
|
545
|
+
if (child !== null && child !== undefined && typeof child !== "boolean") keys.push(pageKey(child, keys.length));
|
|
546
|
+
});
|
|
547
|
+
const itemKeys = config.items.map(item => item.key);
|
|
548
|
+
if (!keys.length || !keys.includes(config.selectedKey ?? "") || new Set(keys).size !== keys.length || new Set(itemKeys).size !== itemKeys.length || keys.some(key => !itemKeys.includes(key))) return null;
|
|
549
|
+
const progress = Math.min(Math.max(0, this.tabProgress), keys.length - 1);
|
|
550
|
+
const source = Math.floor(progress);
|
|
551
|
+
const destination = Math.min(source + 1, keys.length - 1);
|
|
552
|
+
const fraction = progress - source;
|
|
553
|
+
return new Map(keys.map((key, index) => [key, index === source ? 1 - fraction : index === destination ? fraction : 0]));
|
|
554
|
+
}
|
|
555
|
+
tabFontOwnerKey(weights) {
|
|
556
|
+
const config = this.props.nativeTabBar;
|
|
557
|
+
const semantic = config?.controlled ? config.selectedKey : config?.items[this.state.selectedPage]?.key;
|
|
558
|
+
if (!weights || this.tabProgress === null) return semantic;
|
|
559
|
+
const keys = Array.from(weights.keys());
|
|
560
|
+
const progress = Math.min(Math.max(0, this.tabProgress), keys.length - 1);
|
|
561
|
+
return keys[Math.floor(progress + 0.5)];
|
|
562
|
+
}
|
|
563
|
+
tabColor(selected, weight) {
|
|
564
|
+
const style = this.props.nativeTabBar?.style;
|
|
565
|
+
const active = style?.activeTextColor ?? "#000000";
|
|
566
|
+
const inactive = style?.inactiveTextColor ?? "#666666";
|
|
567
|
+
if (weight === undefined) return String(selected ? active : inactive);
|
|
568
|
+
if (weight <= 0) return String(inactive);
|
|
569
|
+
if (weight >= 1) return String(active);
|
|
570
|
+
const first = processColor(inactive);
|
|
571
|
+
const last = processColor(active);
|
|
572
|
+
if (typeof first !== "number" || typeof last !== "number") return String(selected ? active : inactive);
|
|
573
|
+
const channel = shift => (first >>> shift & 255) * (1 - weight) + (last >>> shift & 255) * weight;
|
|
574
|
+
return `rgba(${Math.round(channel(16))}, ${Math.round(channel(8))}, ${Math.round(channel(0))}, ${(channel(24) / 255).toFixed(4)})`;
|
|
575
|
+
}
|
|
576
|
+
syncTabColors() {
|
|
577
|
+
const weights = this.tabColorWeights();
|
|
578
|
+
const config = this.props.nativeTabBar;
|
|
579
|
+
if (!config) return;
|
|
580
|
+
const selectedKey = config.controlled ? config.selectedKey : config.items[this.state.selectedPage]?.key;
|
|
581
|
+
const fontOwnerKey = this.tabFontOwnerKey(weights);
|
|
582
|
+
for (const [key, button] of this.tabButtons) {
|
|
583
|
+
const fontSelected = key === fontOwnerKey;
|
|
584
|
+
button.style.color = this.tabColor(key === selectedKey, weights ? weights.get(key) ?? 0 : undefined);
|
|
585
|
+
button.style.fontWeight = config.style?.variant === "text" && fontSelected ? "600" : "500";
|
|
586
|
+
const fontFamily = (fontSelected ? config.style?.activeFontFamily ?? config.style?.fontFamily : config.style?.fontFamily) ?? "";
|
|
587
|
+
if (config.controlled && config.style?.variant === "text") {
|
|
588
|
+
button.style.fontFamily = config.style?.fontFamily ?? "";
|
|
589
|
+
const label = button.querySelector(".ok-pager-tab-label");
|
|
590
|
+
if (label) label.style.fontFamily = fontFamily;
|
|
591
|
+
} else button.style.fontFamily = fontFamily;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
459
594
|
pageScrollElement(index) {
|
|
460
595
|
const pageHost = this.pageHosts.get(index);
|
|
461
596
|
return pageHost?.querySelector("[data-collapsible-pager-scroll]") ?? pageHost?.querySelector(".ok-native-list-viewport") ?? pageHost;
|
|
@@ -470,7 +605,9 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
470
605
|
this.root?.removeEventListener("touchend", this.onOverlayTouchEnd);
|
|
471
606
|
this.root?.removeEventListener("touchcancel", this.onOverlayTouchEnd);
|
|
472
607
|
this.overlayTouch = null;
|
|
608
|
+
if (this.root) this.chromeObserver?.unobserve(this.root);
|
|
473
609
|
this.root = root;
|
|
610
|
+
if (root) this.chromeObserver?.observe(root);else this.suspendToolbar();
|
|
474
611
|
root?.addEventListener("ok-collapsible-pager-scroll-key-changed", this.onScrollOwnerIdentityChanged);
|
|
475
612
|
root?.addEventListener("wheel", this.onOverlayWheel, {
|
|
476
613
|
passive: false
|
|
@@ -740,11 +877,15 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
740
877
|
if (this.routeTarget && this.routeTarget.key !== expectedKey) this.setRouteTarget(null);
|
|
741
878
|
this.cancelPendingTopFrame();
|
|
742
879
|
this.savePageOffset(this.state.selectedPage);
|
|
743
|
-
if (animated) this.beginPageTransition();else
|
|
880
|
+
if (animated) this.beginPageTransition();else {
|
|
881
|
+
this.finishPageTransition();
|
|
882
|
+
this.tabProgress = position;
|
|
883
|
+
}
|
|
744
884
|
this.setState({
|
|
745
885
|
selectedPage: position,
|
|
746
886
|
animateTransition: animated
|
|
747
887
|
}, () => {
|
|
888
|
+
if (animated) this.startTabProgressFrames();
|
|
748
889
|
this.scheduleScrollConfiguration();
|
|
749
890
|
const restore = () => {
|
|
750
891
|
if (this.selectionRestoreToken !== selectionToken || this.state.selectedPage !== position || this.pages().map(pageKey)[position] !== expectedKey || !this.pageScrollElement(position)?.isConnected) return;
|
|
@@ -815,6 +956,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
815
956
|
this.cancelPendingTopFrame();
|
|
816
957
|
this.horizontalTouch = true;
|
|
817
958
|
this.emitPageScrollState("dragging");
|
|
959
|
+
this.suspendToolbar();
|
|
818
960
|
}
|
|
819
961
|
};
|
|
820
962
|
onTouchEnd = event => {
|
|
@@ -847,9 +989,388 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
847
989
|
this.horizontalTouch = false;
|
|
848
990
|
if (wasHorizontal) this.finishPageTransition();
|
|
849
991
|
};
|
|
992
|
+
toolbarSlot = null;
|
|
993
|
+
toolbarButton = null;
|
|
994
|
+
toolbarIconIdentity = "";
|
|
995
|
+
toolbarLoadedIcon = null;
|
|
996
|
+
toolbarPendingIdentity = "";
|
|
997
|
+
toolbarReadyIcon = null;
|
|
998
|
+
toolbarFailedIdentity = "";
|
|
999
|
+
toolbarAnimation = null;
|
|
1000
|
+
toolbarPresence = false;
|
|
1001
|
+
toolbarPresenceInterrupted = false;
|
|
1002
|
+
toolbarImage = null;
|
|
1003
|
+
toolbarGeneration = 0;
|
|
1004
|
+
ownsSettledToolbar() {
|
|
1005
|
+
return this.props.nativeTabBar?.controlled === true && this.props.nativeTabBar.toolbar !== undefined;
|
|
1006
|
+
}
|
|
1007
|
+
toolbarCanCommit() {
|
|
1008
|
+
if (!this.ownsSettledToolbar()) return true;
|
|
1009
|
+
if (this.disposed || this.props.isActive === false || this.horizontalTouch || this.transitionTimer !== null || this.pageScrollState !== "idle" || !this.root?.isConnected) return false;
|
|
1010
|
+
const actual = this.readTabProgress();
|
|
1011
|
+
if (actual === null || Math.abs(actual - this.state.selectedPage) > 0.001) return false;
|
|
1012
|
+
const config = this.props.nativeTabBar;
|
|
1013
|
+
const keys = [];
|
|
1014
|
+
React.Children.forEach(this.props.children, child => {
|
|
1015
|
+
if (child !== null && child !== undefined && typeof child !== "boolean") keys.push(pageKey(child, keys.length));
|
|
1016
|
+
});
|
|
1017
|
+
const itemKeys = config.items.map(item => item.key);
|
|
1018
|
+
const valid = keys.length > 0 && new Set(keys).size === keys.length && new Set(itemKeys).size === itemKeys.length && keys.every(key => itemKeys.includes(key));
|
|
1019
|
+
return !valid || !keys.includes(config.selectedKey ?? "") || keys[this.state.selectedPage] === config.selectedKey;
|
|
1020
|
+
}
|
|
1021
|
+
cancelToolbarPending() {
|
|
1022
|
+
if (this.toolbarPendingIdentity || this.toolbarImage || this.toolbarReadyIcon) this.toolbarGeneration += 1;
|
|
1023
|
+
if (this.toolbarImage) this.toolbarImage.onload = this.toolbarImage.onerror = null;
|
|
1024
|
+
this.toolbarImage = null;
|
|
1025
|
+
this.toolbarPendingIdentity = "";
|
|
1026
|
+
this.toolbarReadyIcon = null;
|
|
1027
|
+
}
|
|
1028
|
+
setToolbarInteractive(enabled) {
|
|
1029
|
+
const button = this.toolbarButton;
|
|
1030
|
+
if (!button) return;
|
|
1031
|
+
if (!enabled) {
|
|
1032
|
+
if (button.ownerDocument.activeElement === button) button.blur();
|
|
1033
|
+
if (this.toolbarTouchKey !== undefined) this.toolbarTouchKey = null;
|
|
1034
|
+
}
|
|
1035
|
+
button.disabled = !enabled;
|
|
1036
|
+
button.style.pointerEvents = enabled ? "auto" : "none";
|
|
1037
|
+
button.tabIndex = enabled ? 0 : -1;
|
|
1038
|
+
button.setAttribute("aria-hidden", String(!enabled));
|
|
1039
|
+
}
|
|
1040
|
+
suspendToolbar() {
|
|
1041
|
+
if (!this.ownsSettledToolbar()) return;
|
|
1042
|
+
this.setToolbarInteractive(false);
|
|
1043
|
+
this.cancelToolbarPending();
|
|
1044
|
+
if (this.toolbarAnimation && this.toolbarButton) {
|
|
1045
|
+
const opacity = this.toolbarButton.ownerDocument.defaultView?.getComputedStyle(this.toolbarButton).opacity;
|
|
1046
|
+
this.toolbarAnimation.cancel();
|
|
1047
|
+
this.toolbarAnimation = null;
|
|
1048
|
+
this.toolbarButton.style.opacity = opacity || this.toolbarButton.style.opacity;
|
|
1049
|
+
this.toolbarPresenceInterrupted = true;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
setToolbarSlot = slot => {
|
|
1053
|
+
if (this.toolbarSlot === slot) return;
|
|
1054
|
+
this.toolbarAnimation?.cancel();
|
|
1055
|
+
this.toolbarAnimation = null;
|
|
1056
|
+
this.cancelToolbarPending();
|
|
1057
|
+
this.toolbarGeneration += 1;
|
|
1058
|
+
this.toolbarButton?.remove();
|
|
1059
|
+
this.toolbarButton = null;
|
|
1060
|
+
this.toolbarOwnerKey = undefined;
|
|
1061
|
+
this.toolbarOwnerEntry = undefined;
|
|
1062
|
+
this.toolbarIconIdentity = "";
|
|
1063
|
+
this.toolbarLoadedIcon = null;
|
|
1064
|
+
this.toolbarFailedIdentity = "";
|
|
1065
|
+
this.toolbarPresence = false;
|
|
1066
|
+
this.toolbarPresenceInterrupted = false;
|
|
1067
|
+
this.toolbarTouchKey = null;
|
|
1068
|
+
this.toolbarSlot = slot;
|
|
1069
|
+
if (slot) this.syncToolbar();
|
|
1070
|
+
};
|
|
1071
|
+
animateToolbar(visible) {
|
|
1072
|
+
const button = this.toolbarButton;
|
|
1073
|
+
if (!button || this.toolbarPresence === visible && !this.toolbarPresenceInterrupted) return;
|
|
1074
|
+
this.toolbarPresenceInterrupted = false;
|
|
1075
|
+
this.toolbarPresence = visible;
|
|
1076
|
+
const current = button.ownerDocument.defaultView?.getComputedStyle(button).opacity ?? button.style.opacity;
|
|
1077
|
+
this.toolbarAnimation?.cancel();
|
|
1078
|
+
this.toolbarAnimation = null;
|
|
1079
|
+
button.style.opacity = visible ? "1" : "0";
|
|
1080
|
+
const finish = () => {
|
|
1081
|
+
button.hidden = !visible;
|
|
1082
|
+
if (!visible && !this.toolbarOwnerKey && this.toolbarButton === button) {
|
|
1083
|
+
button.remove();
|
|
1084
|
+
this.toolbarButton = null;
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
if (typeof button.animate !== "function") {
|
|
1088
|
+
finish();
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
button.hidden = false;
|
|
1092
|
+
const animation = button.animate([{
|
|
1093
|
+
opacity: current || "0"
|
|
1094
|
+
}, {
|
|
1095
|
+
opacity: visible ? "1" : "0"
|
|
1096
|
+
}], {
|
|
1097
|
+
duration: 100,
|
|
1098
|
+
fill: "forwards"
|
|
1099
|
+
});
|
|
1100
|
+
this.toolbarAnimation = animation;
|
|
1101
|
+
animation.onfinish = () => {
|
|
1102
|
+
if (this.toolbarAnimation !== animation || this.toolbarButton !== button || this.toolbarPresence !== visible) return;
|
|
1103
|
+
animation.cancel();
|
|
1104
|
+
this.toolbarAnimation = null;
|
|
1105
|
+
finish();
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
hideToolbar(failed) {
|
|
1109
|
+
this.setToolbarInteractive(false);
|
|
1110
|
+
this.toolbarOwnerKey = undefined;
|
|
1111
|
+
this.toolbarOwnerEntry = undefined;
|
|
1112
|
+
this.toolbarButton?.removeAttribute("data-testid");
|
|
1113
|
+
this.toolbarButton?.removeAttribute("aria-label");
|
|
1114
|
+
if (failed) this.toolbarButton?.replaceChildren();
|
|
1115
|
+
this.animateToolbar(false);
|
|
1116
|
+
}
|
|
1117
|
+
commitToolbar(key, entry, icon, identity) {
|
|
1118
|
+
const button = this.toolbarButton;
|
|
1119
|
+
if (!button || !this.toolbarCanCommit()) return;
|
|
1120
|
+
if (this.toolbarOwnerKey !== key && this.toolbarTouchKey !== undefined) this.toolbarTouchKey = null;
|
|
1121
|
+
const size = Math.min(128, Math.max(1, entry.size ?? 38));
|
|
1122
|
+
const iconSize = Math.min(size, Math.max(1, entry.iconSize ?? 24));
|
|
1123
|
+
const contentWidth = Math.min(size, Math.max(0, entry.contentWidth ?? 24));
|
|
1124
|
+
const trailingInset = Math.min(128, Math.max(0, entry.trailingInset ?? 20));
|
|
1125
|
+
if (button.firstChild !== icon) button.replaceChildren(icon);
|
|
1126
|
+
Object.assign(button.style, {
|
|
1127
|
+
position: "absolute",
|
|
1128
|
+
width: `${size}px`,
|
|
1129
|
+
height: `${size}px`,
|
|
1130
|
+
borderRadius: "50%",
|
|
1131
|
+
top: "50%",
|
|
1132
|
+
transform: "translateY(-50%)",
|
|
1133
|
+
insetInlineEnd: `${trailingInset - (size - contentWidth) / 2}px`,
|
|
1134
|
+
padding: `${(size - iconSize) / 2}px`,
|
|
1135
|
+
color: entry.iconColor ?? "#000000"
|
|
1136
|
+
});
|
|
1137
|
+
const base = entry.selected ? entry.selectedBackgroundColor ?? "transparent" : "transparent";
|
|
1138
|
+
button.style.setProperty("--pager-toolbar-base", base);
|
|
1139
|
+
button.style.setProperty("--pager-toolbar-hover", entry.hoverBackgroundColor ?? base);
|
|
1140
|
+
button.style.setProperty("--pager-toolbar-pressed", entry.pressedBackgroundColor ?? base);
|
|
1141
|
+
button.setAttribute("aria-label", entry.accessibilityLabel ?? "");
|
|
1142
|
+
if (entry.testID) button.setAttribute("data-testid", entry.testID);else button.removeAttribute("data-testid");
|
|
1143
|
+
this.toolbarOwnerKey = key;
|
|
1144
|
+
this.toolbarOwnerEntry = {
|
|
1145
|
+
...entry
|
|
1146
|
+
};
|
|
1147
|
+
this.toolbarIconIdentity = identity;
|
|
1148
|
+
this.toolbarLoadedIcon = icon;
|
|
1149
|
+
this.toolbarPendingIdentity = "";
|
|
1150
|
+
this.toolbarReadyIcon = null;
|
|
1151
|
+
this.toolbarImage = null;
|
|
1152
|
+
this.animateToolbar(true);
|
|
1153
|
+
this.setToolbarInteractive(true);
|
|
1154
|
+
}
|
|
1155
|
+
syncToolbar() {
|
|
1156
|
+
const slot = this.toolbarSlot;
|
|
1157
|
+
if (!slot) return;
|
|
1158
|
+
if (!this.toolbarCanCommit()) {
|
|
1159
|
+
this.suspendToolbar();
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
const config = this.props.nativeTabBar;
|
|
1163
|
+
const key = config?.controlled ? config.selectedKey : config?.items[this.state.selectedPage]?.key;
|
|
1164
|
+
const entry = key ? config?.toolbar?.[key] : undefined;
|
|
1165
|
+
if (!entry?.iconName || !key) {
|
|
1166
|
+
this.cancelToolbarPending();
|
|
1167
|
+
this.hideToolbar(false);
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
let button = this.toolbarButton;
|
|
1171
|
+
if (!button) {
|
|
1172
|
+
button = slot.ownerDocument.createElement("button");
|
|
1173
|
+
button.type = "button";
|
|
1174
|
+
button.className = "ok-pager-toolbar";
|
|
1175
|
+
button.style.opacity = "0";
|
|
1176
|
+
button.hidden = true;
|
|
1177
|
+
button.disabled = true;
|
|
1178
|
+
button.addEventListener("pointerdown", () => {
|
|
1179
|
+
this.toolbarTouchKey = button.disabled ? null : this.toolbarOwnerKey ?? null;
|
|
1180
|
+
});
|
|
1181
|
+
button.addEventListener("pointercancel", () => {
|
|
1182
|
+
this.toolbarTouchKey = null;
|
|
1183
|
+
});
|
|
1184
|
+
button.onclick = event => {
|
|
1185
|
+
if (this.toolbarButton !== event.currentTarget) return;
|
|
1186
|
+
const pointer = event.detail !== 0;
|
|
1187
|
+
const touched = this.toolbarTouchKey;
|
|
1188
|
+
if (pointer) this.toolbarTouchKey = undefined;
|
|
1189
|
+
const current = this.props.nativeTabBar;
|
|
1190
|
+
const semantic = current?.controlled ? current.selectedKey : current?.items[this.state.selectedPage]?.key;
|
|
1191
|
+
const owner = this.toolbarOwnerKey;
|
|
1192
|
+
if (button.disabled || !this.toolbarCanCommit() || !owner || owner !== semantic || !this.toolbarOwnerEntry || pointer && touched !== owner) return;
|
|
1193
|
+
const rect = button.getBoundingClientRect();
|
|
1194
|
+
this.props.onNativeToolbarPress?.({
|
|
1195
|
+
nativeEvent: {
|
|
1196
|
+
key: owner,
|
|
1197
|
+
anchorRect: {
|
|
1198
|
+
x: rect.x,
|
|
1199
|
+
y: rect.y,
|
|
1200
|
+
width: rect.width,
|
|
1201
|
+
height: rect.height
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
slot.appendChild(button);
|
|
1207
|
+
this.toolbarButton = button;
|
|
1208
|
+
this.toolbarPresence = false;
|
|
1209
|
+
}
|
|
1210
|
+
const size = Math.min(128, Math.max(1, entry.size ?? 38));
|
|
1211
|
+
const iconSize = Math.min(size, Math.max(1, entry.iconSize ?? 24));
|
|
1212
|
+
const identity = `${entry.iconName}|${entry.iconColor ?? "#000000"}|${iconSize}`;
|
|
1213
|
+
if (identity === this.toolbarIconIdentity && this.toolbarLoadedIcon) {
|
|
1214
|
+
this.cancelToolbarPending();
|
|
1215
|
+
this.commitToolbar(key, entry, this.toolbarLoadedIcon, identity);
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
if (identity === this.toolbarPendingIdentity) {
|
|
1219
|
+
if (this.toolbarReadyIcon) this.commitToolbar(key, entry, this.toolbarReadyIcon, identity);
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
this.cancelToolbarPending();
|
|
1223
|
+
this.setToolbarInteractive(false);
|
|
1224
|
+
this.toolbarPendingIdentity = identity;
|
|
1225
|
+
if (identity === this.toolbarFailedIdentity) {
|
|
1226
|
+
this.hideToolbar(true);
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
const generation = ++this.toolbarGeneration;
|
|
1230
|
+
const icon = createNamedIcon(button.ownerDocument, entry.iconName);
|
|
1231
|
+
icon.setAttribute("width", String(iconSize));
|
|
1232
|
+
icon.setAttribute("height", String(iconSize));
|
|
1233
|
+
const use = icon.querySelector("use");
|
|
1234
|
+
const fail = () => {
|
|
1235
|
+
if (this.toolbarGeneration !== generation || this.toolbarPendingIdentity !== identity) return;
|
|
1236
|
+
this.toolbarImage = null;
|
|
1237
|
+
this.toolbarFailedIdentity = identity;
|
|
1238
|
+
this.hideToolbar(true);
|
|
1239
|
+
};
|
|
1240
|
+
if (!use) {
|
|
1241
|
+
fail();
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
const ready = () => {
|
|
1245
|
+
if (this.disposed || this.toolbarGeneration !== generation || this.toolbarPendingIdentity !== identity) return;
|
|
1246
|
+
this.toolbarImage = null;
|
|
1247
|
+
this.toolbarReadyIcon = icon;
|
|
1248
|
+
this.syncToolbar();
|
|
1249
|
+
};
|
|
1250
|
+
const href = use.getAttribute("href") ?? use.getAttribute("xlink:href") ?? "";
|
|
1251
|
+
const view = button.ownerDocument.defaultView;
|
|
1252
|
+
if (view?.Image && href.split("#")[0]) {
|
|
1253
|
+
const image = new view.Image();
|
|
1254
|
+
this.toolbarImage = image;
|
|
1255
|
+
image.onload = ready;
|
|
1256
|
+
image.onerror = fail;
|
|
1257
|
+
image.src = href.split("#")[0];
|
|
1258
|
+
} else ready();
|
|
1259
|
+
}
|
|
1260
|
+
renderNativeTabBar() {
|
|
1261
|
+
const config = this.props.nativeTabBar;
|
|
1262
|
+
if (!config?.items.length || config.style?.variant !== "text" && config.controlled !== true && config.toolbar === undefined) return null;
|
|
1263
|
+
const style = config.style;
|
|
1264
|
+
const variant = style?.variant ?? "underline";
|
|
1265
|
+
const selectedKey = config.controlled ? config.selectedKey : config.items[this.state.selectedPage]?.key;
|
|
1266
|
+
const toolbarEntries = config.toolbar === undefined ? undefined : Object.values(config.toolbar);
|
|
1267
|
+
const reservedWidth = toolbarEntries === undefined ? 0 : toolbarEntries.length === 0 ? 44 : Math.max(...toolbarEntries.map(entry => {
|
|
1268
|
+
const size = Math.min(128, Math.max(1, entry.size ?? 38));
|
|
1269
|
+
return Math.min(size, Math.max(0, entry.contentWidth ?? 24)) + Math.min(128, Math.max(0, entry.trailingInset ?? 20));
|
|
1270
|
+
}));
|
|
1271
|
+
const segmented = variant === "segmented";
|
|
1272
|
+
const reserveTextFaces = config.controlled && variant === "text";
|
|
1273
|
+
const colorWeights = this.tabColorWeights();
|
|
1274
|
+
const fontOwnerKey = this.tabFontOwnerKey(colorWeights);
|
|
1275
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1276
|
+
className: "ok-pager-tab-bar",
|
|
1277
|
+
dir: this.props.layoutDirection === "rtl" || (this.props.layoutDirection ?? "locale") === "locale" && I18nManager.isRTL ? "rtl" : "ltr",
|
|
1278
|
+
style: {
|
|
1279
|
+
display: "flex",
|
|
1280
|
+
alignItems: "center",
|
|
1281
|
+
position: "relative",
|
|
1282
|
+
height: style?.height ?? 44,
|
|
1283
|
+
backgroundColor: String(style?.backgroundColor ?? "transparent"),
|
|
1284
|
+
minWidth: 0
|
|
1285
|
+
}
|
|
1286
|
+
}, /*#__PURE__*/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)}`), /*#__PURE__*/React.createElement("div", {
|
|
1287
|
+
role: "tablist",
|
|
1288
|
+
style: {
|
|
1289
|
+
display: "flex",
|
|
1290
|
+
overflowX: segmented ? "hidden" : "auto",
|
|
1291
|
+
flex: 1,
|
|
1292
|
+
padding: `${style?.contentPaddingVertical ?? 0}px ${style?.contentPaddingHorizontal ?? 20}px`,
|
|
1293
|
+
gap: style?.itemSpacing ?? 8
|
|
1294
|
+
}
|
|
1295
|
+
}, ...config.items.map((item, position) => {
|
|
1296
|
+
const selected = item.key === selectedKey;
|
|
1297
|
+
const fontSelected = item.key === fontOwnerKey;
|
|
1298
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
1299
|
+
key: item.key,
|
|
1300
|
+
role: "tab",
|
|
1301
|
+
type: "button",
|
|
1302
|
+
className: "ok-pager-tab",
|
|
1303
|
+
"aria-selected": selected,
|
|
1304
|
+
ref: button => {
|
|
1305
|
+
if (button) this.tabButtons.set(item.key, button);else this.tabButtons.delete(item.key);
|
|
1306
|
+
},
|
|
1307
|
+
"aria-label": item.accessibilityLabel ?? item.title,
|
|
1308
|
+
"data-testid": item.testID,
|
|
1309
|
+
style: {
|
|
1310
|
+
padding: variant === "text" ? "6px 10px" : "6px 8px",
|
|
1311
|
+
minWidth: 44,
|
|
1312
|
+
height: (style?.height ?? 44) - 2 * (style?.contentPaddingVertical ?? 0),
|
|
1313
|
+
fontSize: style?.fontSize ?? (variant === "text" ? 18 : 16),
|
|
1314
|
+
fontWeight: variant === "text" && fontSelected ? 600 : 500,
|
|
1315
|
+
fontFamily: reserveTextFaces ? style?.fontFamily : fontSelected ? style?.activeFontFamily ?? style?.fontFamily : style?.fontFamily,
|
|
1316
|
+
display: reserveTextFaces ? "inline-grid" : undefined,
|
|
1317
|
+
gridTemplateAreas: reserveTextFaces ? '"label"' : undefined,
|
|
1318
|
+
alignItems: reserveTextFaces ? "center" : undefined,
|
|
1319
|
+
color: this.tabColor(selected, colorWeights ? colorWeights.get(item.key) ?? 0 : undefined),
|
|
1320
|
+
flex: segmented ? 1 : undefined,
|
|
1321
|
+
borderRadius: segmented ? 999 : 0,
|
|
1322
|
+
backgroundColor: segmented && selected ? String(style?.indicatorColor ?? "transparent") : "transparent",
|
|
1323
|
+
borderBottom: variant === "underline" && selected ? `${style?.indicatorHeight ?? 2}px solid ${String(style?.indicatorColor ?? "#000000")}` : undefined
|
|
1324
|
+
},
|
|
1325
|
+
onClick: () => {
|
|
1326
|
+
if (!config.controlled) {
|
|
1327
|
+
const animated = this.props.nativeTabPressAnimationEnabled ?? Math.abs(position - this.state.selectedPage) <= 1;
|
|
1328
|
+
if (animated) this.setPage(position);else this.setPageWithoutAnimation(position);
|
|
1329
|
+
}
|
|
1330
|
+
this.props.onNativeTabPress?.({
|
|
1331
|
+
nativeEvent: {
|
|
1332
|
+
position,
|
|
1333
|
+
key: item.key
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
}, reserveTextFaces ? [/*#__PURE__*/React.createElement("span", {
|
|
1338
|
+
key: "label",
|
|
1339
|
+
className: "ok-pager-tab-label",
|
|
1340
|
+
style: {
|
|
1341
|
+
gridArea: "label",
|
|
1342
|
+
fontFamily: fontSelected ? style?.activeFontFamily ?? style?.fontFamily : style?.fontFamily
|
|
1343
|
+
}
|
|
1344
|
+
}, item.title), ...[false, true].map(active => /*#__PURE__*/React.createElement("span", {
|
|
1345
|
+
key: active ? "active-width" : "normal-width",
|
|
1346
|
+
"aria-hidden": true,
|
|
1347
|
+
style: {
|
|
1348
|
+
gridArea: "label",
|
|
1349
|
+
visibility: "hidden",
|
|
1350
|
+
pointerEvents: "none",
|
|
1351
|
+
userSelect: "none",
|
|
1352
|
+
fontWeight: active ? 600 : 500,
|
|
1353
|
+
fontFamily: active ? style?.activeFontFamily ?? style?.fontFamily : style?.fontFamily
|
|
1354
|
+
}
|
|
1355
|
+
}, item.title))] : item.title);
|
|
1356
|
+
})), config.toolbar !== undefined ? /*#__PURE__*/React.createElement("div", {
|
|
1357
|
+
ref: this.setToolbarSlot,
|
|
1358
|
+
className: "ok-pager-toolbar-slot",
|
|
1359
|
+
style: {
|
|
1360
|
+
flexShrink: 0,
|
|
1361
|
+
width: reservedWidth,
|
|
1362
|
+
height: "100%",
|
|
1363
|
+
position: "relative"
|
|
1364
|
+
}
|
|
1365
|
+
}) : null);
|
|
1366
|
+
}
|
|
850
1367
|
render() {
|
|
851
1368
|
const {
|
|
852
1369
|
children: _children,
|
|
1370
|
+
nativeTabBar: _nativeTabBar,
|
|
1371
|
+
nativeTabPressAnimationEnabled: _nativeTabPressAnimationEnabled,
|
|
1372
|
+
onNativeTabPress: _onNativeTabPress,
|
|
1373
|
+
onNativeToolbarPress: _onNativeToolbarPress,
|
|
853
1374
|
header,
|
|
854
1375
|
stickyHeader,
|
|
855
1376
|
topOverlay: _topOverlay,
|
|
@@ -858,6 +1379,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
858
1379
|
externalTopOverlayTag: _externalTopOverlayTag,
|
|
859
1380
|
headerHeight: _headerHeight,
|
|
860
1381
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
1382
|
+
stickyHeaderHeights: _stickyHeaderHeights,
|
|
861
1383
|
isActive: _isActive,
|
|
862
1384
|
pageRetentionDistance: _pageRetentionDistance,
|
|
863
1385
|
layoutDirection: _layoutDirection,
|
|
@@ -918,9 +1440,11 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
918
1440
|
top: this.headerHeight,
|
|
919
1441
|
height: this.stickyHeaderHeight
|
|
920
1442
|
}, collapseAnimation],
|
|
921
|
-
children: this.hasExplicitStickyHeaderHeight ?
|
|
1443
|
+
children: this.hasExplicitStickyHeaderHeight ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
1444
|
+
children: [this.renderNativeTabBar(), stickyHeader]
|
|
1445
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
922
1446
|
ref: this.setStickyContent,
|
|
923
|
-
children: stickyHeader
|
|
1447
|
+
children: [this.renderNativeTabBar(), stickyHeader]
|
|
924
1448
|
})
|
|
925
1449
|
}), /*#__PURE__*/_jsx(View, {
|
|
926
1450
|
ref: this.setTrack,
|