@onekeyfe/react-native-pager-view 6.7.0-6 → 6.7.0-61
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 +159 -115
- 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 +233 -43
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerNativeHeaders.kt +596 -27
- 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 +716 -10
- package/ios/RNCCollapsiblePagerViewComponentView.mm +2246 -97
- package/ios/RNCNativeScrollerComponentView.h +2 -0
- package/ios/RNCNativeScrollerComponentView.mm +42 -0
- package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +723 -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 +75 -11
- package/lib/module/CollapsiblePagerView.web.js +653 -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/typescript/src/CollapsiblePagerView.d.ts +62 -4
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +56 -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/usePagerView.d.ts +2 -2
- package/lib/typescript/src/utils.d.ts +2 -2
- package/package.json +20 -7
- package/react-native-pager-view.podspec +1 -0
- package/src/CollapsiblePagerView.tsx +208 -12
- package/src/CollapsiblePagerView.web.tsx +587 -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScrollEdgeEffect } from "./ScrollEdgeEffect";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { I18nManager, Platform, StyleSheet, View } from "react-native";
|
|
3
|
+
import { I18nManager, Platform, StyleSheet, View, processColor } from "react-native";
|
|
4
4
|
import type * as ReactNative from "react-native";
|
|
5
5
|
|
|
6
6
|
import CollapsiblePagerViewNativeComponent, {
|
|
@@ -32,20 +32,67 @@ export type CollapsiblePagerNativeTabBarItem = Readonly<{
|
|
|
32
32
|
}>;
|
|
33
33
|
|
|
34
34
|
export type CollapsiblePagerNativeTabBarStyle = Readonly<{
|
|
35
|
+
/**
|
|
36
|
+
* `pill` draws a rounded background behind the selected item that follows
|
|
37
|
+
* pager progress, with active / inactive label colors.
|
|
38
|
+
*/
|
|
39
|
+
variant?: "underline" | "segmented" | "text" | "pill";
|
|
35
40
|
height?: number;
|
|
41
|
+
trailingReservedWidth?: number;
|
|
36
42
|
contentPaddingHorizontal?: number;
|
|
43
|
+
contentPaddingVertical?: number;
|
|
37
44
|
itemSpacing?: number;
|
|
38
45
|
fontSize?: number;
|
|
39
46
|
fontFamily?: string;
|
|
47
|
+
activeFontFamily?: string;
|
|
40
48
|
backgroundColor?: ReactNative.ColorValue;
|
|
41
49
|
activeTextColor?: ReactNative.ColorValue;
|
|
42
50
|
inactiveTextColor?: ReactNative.ColorValue;
|
|
43
51
|
indicatorColor?: ReactNative.ColorValue;
|
|
44
52
|
indicatorHeight?: number;
|
|
45
53
|
indicatorBottom?: number;
|
|
54
|
+
/** Horizontal padding inside each item. Defaults: text 10, pill 14, others 8. */
|
|
55
|
+
itemPaddingHorizontal?: number;
|
|
56
|
+
/** Pill variant: background of an unselected item under the pointer. */
|
|
57
|
+
itemHoverBackgroundColor?: ReactNative.ColorValue;
|
|
58
|
+
/** Pill variant: background of an unselected item while pressed. */
|
|
59
|
+
itemPressedBackgroundColor?: ReactNative.ColorValue;
|
|
60
|
+
/**
|
|
61
|
+
* Caps the width of the tab row and toolbar and centers them; the bar
|
|
62
|
+
* background still spans the full width.
|
|
63
|
+
*/
|
|
64
|
+
contentMaxWidth?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Pill variant: when false, the pill and label colors jump to the selected
|
|
67
|
+
* item instead of following pager progress or animating. Defaults to true.
|
|
68
|
+
*/
|
|
69
|
+
indicatorAnimationEnabled?: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
|
|
72
|
+
export type CollapsiblePagerToolbarItem = Readonly<{
|
|
73
|
+
iconName: string;
|
|
74
|
+
selected?: boolean;
|
|
75
|
+
accessibilityLabel?: string;
|
|
76
|
+
testID?: string;
|
|
77
|
+
iconColor?: string;
|
|
78
|
+
selectedBackgroundColor?: string;
|
|
79
|
+
hoverBackgroundColor?: string;
|
|
80
|
+
pressedBackgroundColor?: string;
|
|
81
|
+
size?: number;
|
|
82
|
+
iconSize?: number;
|
|
83
|
+
contentWidth?: number;
|
|
84
|
+
trailingInset?: number;
|
|
85
|
+
}>;
|
|
86
|
+
|
|
87
|
+
export type CollapsiblePagerToolbarPress = Readonly<{
|
|
88
|
+
key: string;
|
|
89
|
+
anchorRect: Readonly<{ x: number; y: number; width: number; height: number }>;
|
|
46
90
|
}>;
|
|
47
91
|
|
|
48
92
|
export type CollapsiblePagerNativeTabBarConfig = Readonly<{
|
|
93
|
+
controlled?: boolean;
|
|
94
|
+
selectedKey?: string;
|
|
95
|
+
toolbar?: Readonly<Record<string, CollapsiblePagerToolbarItem>>;
|
|
49
96
|
items: readonly CollapsiblePagerNativeTabBarItem[];
|
|
50
97
|
style?: CollapsiblePagerNativeTabBarStyle;
|
|
51
98
|
}>;
|
|
@@ -87,14 +134,20 @@ export interface CollapsiblePagerViewProps
|
|
|
87
134
|
| "children"
|
|
88
135
|
| "headerHeight"
|
|
89
136
|
| "stickyHeaderHeight"
|
|
137
|
+
| "stickyHeaderHeights"
|
|
90
138
|
| "topScrollEdgeEffect"
|
|
91
139
|
| "topOverlayHeight"
|
|
92
140
|
| "externalTopOverlayTag"
|
|
93
141
|
| "pageKeys"
|
|
94
142
|
| "retainedPages"
|
|
143
|
+
| "nativeTabBarConfig"
|
|
144
|
+
| "onNativeToolbarPress"
|
|
95
145
|
| "nativeTabBarItems"
|
|
96
146
|
| "nativeTabBarHeight"
|
|
147
|
+
| "nativeTabBarVariant"
|
|
148
|
+
| "nativeTabBarTrailingReservedWidth"
|
|
97
149
|
| "nativeTabBarContentPaddingHorizontal"
|
|
150
|
+
| "nativeTabBarContentPaddingVertical"
|
|
98
151
|
| "nativeTabBarItemSpacing"
|
|
99
152
|
| "nativeTabBarFontSize"
|
|
100
153
|
| "nativeTabBarFontFamily"
|
|
@@ -118,8 +171,12 @@ export interface CollapsiblePagerViewProps
|
|
|
118
171
|
headerHeight: number;
|
|
119
172
|
/** Measured sticky bar height. */
|
|
120
173
|
stickyHeaderHeight: number;
|
|
174
|
+
/** iOS only. Sticky heights in child order, applied before each page is displayed. */
|
|
175
|
+
stickyHeaderHeights?: readonly number[];
|
|
121
176
|
/** Fixed content above the collapsible header on iOS 26 and newer. */
|
|
122
177
|
topOverlay?: React.ReactNode;
|
|
178
|
+
/** Known overlay height to reserve until its first layout measurement. */
|
|
179
|
+
topOverlayHeightHint?: number;
|
|
123
180
|
/** Existing fixed header shared with a parent pager on iOS 26 and newer. */
|
|
124
181
|
externalTopOverlayTag?: number;
|
|
125
182
|
/** Selects UIKit's top scroll-edge effect on iOS 26 and newer. */
|
|
@@ -140,6 +197,7 @@ export interface CollapsiblePagerViewProps
|
|
|
140
197
|
layoutDirection?: "ltr" | "rtl" | "locale";
|
|
141
198
|
/** Optional native tab bar for iOS and Android. */
|
|
142
199
|
nativeTabBar?: CollapsiblePagerNativeTabBarConfig;
|
|
200
|
+
onNativeToolbarPress?: (event: ReactNative.NativeSyntheticEvent<CollapsiblePagerToolbarPress>) => void;
|
|
143
201
|
onNativeTabPress?: (event: CollapsiblePagerViewOnNativeTabPressEvent) => void;
|
|
144
202
|
/**
|
|
145
203
|
* Defaults to animating adjacent native tab presses and jumping directly to
|
|
@@ -158,7 +216,21 @@ export interface CollapsiblePagerViewProps
|
|
|
158
216
|
type State = {
|
|
159
217
|
selectedPage: number;
|
|
160
218
|
transientRetainedPages: readonly number[];
|
|
161
|
-
topOverlayHeight: number;
|
|
219
|
+
topOverlayHeight: number | null;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const nativeToolbar = (toolbar: CollapsiblePagerNativeTabBarConfig["toolbar"]) => {
|
|
223
|
+
if (!toolbar) return undefined;
|
|
224
|
+
return Object.fromEntries(Object.entries(toolbar).map(([key, item]) => {
|
|
225
|
+
const color = processColor(item.iconColor ?? "#000000");
|
|
226
|
+
const argb = typeof color === "number" ? color >>> 0 : 0xff000000;
|
|
227
|
+
return [key, { ...item,
|
|
228
|
+
iconColor: `rgba(${(argb >>> 16) & 255},${(argb >>> 8) & 255},${argb & 255},${Math.round(((argb >>> 24) / 255) * 1000000) / 1000000})`,
|
|
229
|
+
selectedBackgroundColor: processColor(item.selectedBackgroundColor ?? "transparent"),
|
|
230
|
+
hoverBackgroundColor: processColor(item.hoverBackgroundColor ?? "transparent"),
|
|
231
|
+
pressedBackgroundColor: processColor(item.pressedBackgroundColor ?? "transparent"),
|
|
232
|
+
}];
|
|
233
|
+
}));
|
|
162
234
|
};
|
|
163
235
|
|
|
164
236
|
const pageIndex = (value: number) => {
|
|
@@ -186,7 +258,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
186
258
|
State
|
|
187
259
|
> {
|
|
188
260
|
state: State = {
|
|
189
|
-
topOverlayHeight:
|
|
261
|
+
topOverlayHeight: null,
|
|
190
262
|
selectedPage: clampedPageIndex(
|
|
191
263
|
this.props.initialPage ?? 0,
|
|
192
264
|
React.Children.toArray(this.props.children).length
|
|
@@ -219,7 +291,22 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
219
291
|
this.notifyMountedPagesChanged();
|
|
220
292
|
}
|
|
221
293
|
|
|
222
|
-
componentDidUpdate() {
|
|
294
|
+
componentDidUpdate(previousProps: CollapsiblePagerViewProps) {
|
|
295
|
+
const previousOverlayEnabled =
|
|
296
|
+
previousProps.topOverlay != null &&
|
|
297
|
+
(previousProps.topScrollEdgeEffect === "hard" ||
|
|
298
|
+
previousProps.topScrollEdgeEffect === "soft");
|
|
299
|
+
const overlayEnabled =
|
|
300
|
+
this.props.topOverlay != null &&
|
|
301
|
+
(this.props.topScrollEdgeEffect === "hard" ||
|
|
302
|
+
this.props.topScrollEdgeEffect === "soft");
|
|
303
|
+
if (
|
|
304
|
+
previousOverlayEnabled &&
|
|
305
|
+
!overlayEnabled &&
|
|
306
|
+
this.state.topOverlayHeight !== null
|
|
307
|
+
) {
|
|
308
|
+
this.setState({ topOverlayHeight: null });
|
|
309
|
+
}
|
|
223
310
|
const pageCount = this.pages().length;
|
|
224
311
|
const selectedPage = clampedPageIndex(this.state.selectedPage, pageCount);
|
|
225
312
|
if (selectedPage !== this.state.selectedPage) {
|
|
@@ -237,7 +324,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
237
324
|
position >= 0 &&
|
|
238
325
|
position < this.pages().length
|
|
239
326
|
) {
|
|
240
|
-
if (this.nativeTabBarEnabled()) {
|
|
327
|
+
if (this.nativeTabBarEnabled() && !this.props.nativeTabBar?.controlled) {
|
|
241
328
|
this.dispatchNativeTabPageCommand(position, true);
|
|
242
329
|
} else {
|
|
243
330
|
CollapsiblePagerViewNativeCommands.setPage(this.nativeRef, position);
|
|
@@ -253,7 +340,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
253
340
|
position >= 0 &&
|
|
254
341
|
position < this.pages().length
|
|
255
342
|
) {
|
|
256
|
-
if (this.nativeTabBarEnabled()) {
|
|
343
|
+
if (this.nativeTabBarEnabled() && !this.props.nativeTabBar?.controlled) {
|
|
257
344
|
this.dispatchNativeTabPageCommand(position, false);
|
|
258
345
|
} else {
|
|
259
346
|
CollapsiblePagerViewNativeCommands.setPageWithoutAnimation(
|
|
@@ -273,6 +360,22 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
273
360
|
);
|
|
274
361
|
};
|
|
275
362
|
|
|
363
|
+
public scrollHeaderBy = (delta: number) => {
|
|
364
|
+
if (this.nativeRef && Number.isFinite(delta))
|
|
365
|
+
CollapsiblePagerViewNativeCommands.scrollHeaderBy(
|
|
366
|
+
this.nativeRef,
|
|
367
|
+
delta
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
public scrollHeaderToOffset = (offset: number) => {
|
|
372
|
+
if (this.nativeRef && Number.isFinite(offset))
|
|
373
|
+
CollapsiblePagerViewNativeCommands.scrollHeaderToOffset(
|
|
374
|
+
this.nativeRef,
|
|
375
|
+
offset
|
|
376
|
+
);
|
|
377
|
+
};
|
|
378
|
+
|
|
276
379
|
public scrollToStickyTop = (options?: Readonly<{ animated?: boolean }>) => {
|
|
277
380
|
if (this.nativeRef)
|
|
278
381
|
CollapsiblePagerViewNativeCommands.scrollToTop(
|
|
@@ -302,7 +405,11 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
302
405
|
);
|
|
303
406
|
}
|
|
304
407
|
|
|
305
|
-
private dispatchNativeTabPageCommand(
|
|
408
|
+
private dispatchNativeTabPageCommand(
|
|
409
|
+
position: number,
|
|
410
|
+
animated: boolean,
|
|
411
|
+
expectedKey?: string
|
|
412
|
+
) {
|
|
306
413
|
const commandId = ++this.nativeTabCommandId;
|
|
307
414
|
this.nativeTabCommandQueuedDuringScroll =
|
|
308
415
|
this.nativePagerScrollState !== "idle";
|
|
@@ -315,7 +422,13 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
315
422
|
}),
|
|
316
423
|
() => {
|
|
317
424
|
requestAnimationFrame(() => {
|
|
318
|
-
if (
|
|
425
|
+
if (
|
|
426
|
+
commandId !== this.nativeTabCommandId ||
|
|
427
|
+
!this.nativeRef ||
|
|
428
|
+
(expectedKey !== undefined &&
|
|
429
|
+
(!this.nativeTabBarEnabled() ||
|
|
430
|
+
this.props.nativeTabBar?.items[position]?.key !== expectedKey))
|
|
431
|
+
) {
|
|
319
432
|
return;
|
|
320
433
|
}
|
|
321
434
|
this.dispatchedNativeTabTarget = position;
|
|
@@ -441,7 +554,14 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
441
554
|
) => {
|
|
442
555
|
const position = pageIndex(event.nativeEvent.position);
|
|
443
556
|
if (
|
|
444
|
-
|
|
557
|
+
!this.nativeTabBarEnabled() ||
|
|
558
|
+
position === null ||
|
|
559
|
+
this.props.nativeTabBar?.items[position]?.key !== event.nativeEvent.key
|
|
560
|
+
) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (
|
|
564
|
+
!this.props.nativeTabBar?.controlled &&
|
|
445
565
|
position >= 0 &&
|
|
446
566
|
position < this.pages().length &&
|
|
447
567
|
(position !== this.state.selectedPage ||
|
|
@@ -453,12 +573,20 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
453
573
|
this.dispatchNativeTabPageCommand(
|
|
454
574
|
position,
|
|
455
575
|
this.props.nativeTabPressAnimationEnabled ??
|
|
456
|
-
Math.abs(position - currentPage) <= 1
|
|
576
|
+
Math.abs(position - currentPage) <= 1,
|
|
577
|
+
event.nativeEvent.key
|
|
457
578
|
);
|
|
458
579
|
}
|
|
459
580
|
this.props.onNativeTabPress?.(event);
|
|
460
581
|
};
|
|
461
582
|
|
|
583
|
+
private onNativeToolbarPress = (
|
|
584
|
+
event: ReactNative.NativeSyntheticEvent<CollapsiblePagerToolbarPress>
|
|
585
|
+
) => {
|
|
586
|
+
if (!this.props.nativeTabBar?.toolbar?.[event.nativeEvent.key]?.iconName) return;
|
|
587
|
+
this.props.onNativeToolbarPress?.(event);
|
|
588
|
+
};
|
|
589
|
+
|
|
462
590
|
private onNativeSubHeaderPress = (
|
|
463
591
|
event: ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>
|
|
464
592
|
) => {
|
|
@@ -472,7 +600,9 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
472
600
|
stickyHeader,
|
|
473
601
|
headerHeight,
|
|
474
602
|
stickyHeaderHeight,
|
|
603
|
+
stickyHeaderHeights,
|
|
475
604
|
topOverlay,
|
|
605
|
+
topOverlayHeightHint,
|
|
476
606
|
externalTopOverlayTag,
|
|
477
607
|
topScrollEdgeEffect,
|
|
478
608
|
topOverlayColorScheme,
|
|
@@ -498,6 +628,11 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
498
628
|
supportsTopScrollEdge &&
|
|
499
629
|
(topScrollEdgeEffect === "hard" || topScrollEdgeEffect === "soft");
|
|
500
630
|
const hasTopOverlay = scrollEdgeEnabled && topOverlay != null;
|
|
631
|
+
const initialTopOverlayHeight =
|
|
632
|
+
typeof topOverlayHeightHint === "number" &&
|
|
633
|
+
Number.isFinite(topOverlayHeightHint)
|
|
634
|
+
? Math.max(0, Math.ceil(topOverlayHeightHint))
|
|
635
|
+
: 0;
|
|
501
636
|
const pageKeys = pages.map(pageKey);
|
|
502
637
|
const retained = new Set(this.mountedPages(pages.length));
|
|
503
638
|
const deducedLayoutDirection =
|
|
@@ -510,6 +645,22 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
510
645
|
(Platform.OS === "ios" || Platform.OS === "android") &&
|
|
511
646
|
!!nativeTabBar?.items.length;
|
|
512
647
|
const nativeTabBarStyle = nativeTabBar?.style;
|
|
648
|
+
const requestedContentPaddingVertical =
|
|
649
|
+
nativeTabBarStyle?.contentPaddingVertical;
|
|
650
|
+
const nativeTabBarContentPaddingVertical =
|
|
651
|
+
typeof requestedContentPaddingVertical === "number" &&
|
|
652
|
+
Number.isFinite(requestedContentPaddingVertical) &&
|
|
653
|
+
requestedContentPaddingVertical >= 0
|
|
654
|
+
? requestedContentPaddingVertical
|
|
655
|
+
: 0;
|
|
656
|
+
const requestedTrailingReservedWidth =
|
|
657
|
+
nativeTabBarStyle?.trailingReservedWidth;
|
|
658
|
+
const nativeTabBarTrailingReservedWidth =
|
|
659
|
+
typeof requestedTrailingReservedWidth === "number" &&
|
|
660
|
+
Number.isFinite(requestedTrailingReservedWidth) &&
|
|
661
|
+
requestedTrailingReservedWidth >= 0
|
|
662
|
+
? requestedTrailingReservedWidth
|
|
663
|
+
: 0;
|
|
513
664
|
const nativeSubHeaderEnabled =
|
|
514
665
|
(Platform.OS === "ios" || Platform.OS === "android") &&
|
|
515
666
|
!!nativeSubHeader?.items.length;
|
|
@@ -538,11 +689,24 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
538
689
|
offscreenPageLimit={Math.max(1, offscreenPageLimit ?? 1)}
|
|
539
690
|
headerHeight={Math.max(0, Math.round(headerHeight))}
|
|
540
691
|
stickyHeaderHeight={Math.max(0, Math.round(stickyHeaderHeight))}
|
|
692
|
+
stickyHeaderHeights={
|
|
693
|
+
Platform.OS === "ios" && stickyHeaderHeights
|
|
694
|
+
? JSON.stringify(
|
|
695
|
+
stickyHeaderHeights.slice(0, pages.length).map((height) =>
|
|
696
|
+
Number.isFinite(height) && height >= 0 ? Math.round(height) : null
|
|
697
|
+
)
|
|
698
|
+
)
|
|
699
|
+
: undefined
|
|
700
|
+
}
|
|
541
701
|
topScrollEdgeEffect={scrollEdgeEnabled ? topScrollEdgeEffect : "none"}
|
|
542
702
|
topOverlayColorScheme={
|
|
543
703
|
scrollEdgeEnabled ? topOverlayColorScheme : undefined
|
|
544
704
|
}
|
|
545
|
-
topOverlayHeight={
|
|
705
|
+
topOverlayHeight={
|
|
706
|
+
hasTopOverlay
|
|
707
|
+
? this.state.topOverlayHeight ?? initialTopOverlayHeight
|
|
708
|
+
: 0
|
|
709
|
+
}
|
|
546
710
|
externalTopOverlayTag={
|
|
547
711
|
supportsTopScrollEdge && !hasTopOverlay
|
|
548
712
|
? externalTopOverlayTag ?? 0
|
|
@@ -553,22 +717,54 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
553
717
|
retainedPages={JSON.stringify([...retained])}
|
|
554
718
|
onPageSelected={this.onPageSelected}
|
|
555
719
|
onPageScrollStateChanged={this.onPageScrollStateChanged}
|
|
720
|
+
nativeTabBarConfig={nativeTabBarEnabled ? JSON.stringify({
|
|
721
|
+
controlled: nativeTabBar.controlled,
|
|
722
|
+
selectedKey: nativeTabBar.selectedKey,
|
|
723
|
+
pageKeys: (() => {
|
|
724
|
+
const keys: string[] = [];
|
|
725
|
+
React.Children.forEach(this.props.children, (child) => {
|
|
726
|
+
if (child !== null && child !== undefined && typeof child !== "boolean") keys.push(pageKey(child, keys.length));
|
|
727
|
+
});
|
|
728
|
+
return keys;
|
|
729
|
+
})(),
|
|
730
|
+
toolbar: nativeToolbar(nativeTabBar.toolbar),
|
|
731
|
+
activeFontFamily: nativeTabBar.style?.activeFontFamily,
|
|
732
|
+
itemPaddingHorizontal: nativeTabBar.style?.itemPaddingHorizontal,
|
|
733
|
+
itemHoverBackgroundColor: nativeTabBar.style?.itemHoverBackgroundColor === undefined
|
|
734
|
+
? undefined
|
|
735
|
+
: processColor(nativeTabBar.style.itemHoverBackgroundColor),
|
|
736
|
+
itemPressedBackgroundColor: nativeTabBar.style?.itemPressedBackgroundColor === undefined
|
|
737
|
+
? undefined
|
|
738
|
+
: processColor(nativeTabBar.style.itemPressedBackgroundColor),
|
|
739
|
+
contentMaxWidth: nativeTabBar.style?.contentMaxWidth,
|
|
740
|
+
indicatorAnimationEnabled: nativeTabBar.style?.indicatorAnimationEnabled,
|
|
741
|
+
}) : undefined}
|
|
742
|
+
onNativeToolbarPress={this.onNativeToolbarPress}
|
|
556
743
|
nativeTabBarItems={
|
|
557
744
|
nativeTabBarEnabled ? JSON.stringify(nativeTabBar.items) : undefined
|
|
558
745
|
}
|
|
559
746
|
nativeTabBarHeight={
|
|
560
747
|
nativeTabBarEnabled ? nativeTabBarStyle?.height ?? 44 : undefined
|
|
561
748
|
}
|
|
749
|
+
nativeTabBarVariant={
|
|
750
|
+
nativeTabBarEnabled ? nativeTabBarStyle?.variant ?? "underline" : undefined
|
|
751
|
+
}
|
|
752
|
+
nativeTabBarTrailingReservedWidth={
|
|
753
|
+
nativeTabBarEnabled ? nativeTabBarTrailingReservedWidth : 0
|
|
754
|
+
}
|
|
562
755
|
nativeTabBarContentPaddingHorizontal={
|
|
563
756
|
nativeTabBarEnabled
|
|
564
757
|
? nativeTabBarStyle?.contentPaddingHorizontal ?? 20
|
|
565
758
|
: undefined
|
|
566
759
|
}
|
|
760
|
+
nativeTabBarContentPaddingVertical={
|
|
761
|
+
nativeTabBarEnabled ? nativeTabBarContentPaddingVertical : undefined
|
|
762
|
+
}
|
|
567
763
|
nativeTabBarItemSpacing={
|
|
568
764
|
nativeTabBarEnabled ? nativeTabBarStyle?.itemSpacing ?? 8 : undefined
|
|
569
765
|
}
|
|
570
766
|
nativeTabBarFontSize={
|
|
571
|
-
nativeTabBarEnabled ? nativeTabBarStyle?.fontSize ?? 16 : undefined
|
|
767
|
+
nativeTabBarEnabled ? nativeTabBarStyle?.fontSize ?? (nativeTabBarStyle?.variant === "text" ? 18 : 16) : undefined
|
|
572
768
|
}
|
|
573
769
|
nativeTabBarFontFamily={
|
|
574
770
|
nativeTabBarEnabled ? nativeTabBarStyle?.fontFamily : undefined
|