@onekeyfe/react-native-pager-view 6.7.0-alpha.378 → 6.7.0-alpha.382
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 +5 -0
- package/android/src/androidTest/AndroidManifest.xml +7 -0
- package/android/src/androidTest/java/com/reactnativepagerview/CollapsiblePagerTabReservationTest.kt +247 -0
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerHost.kt +76 -21
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerNativeHeaders.kt +72 -7
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +27 -0
- package/android/src/main/java/com/reactnativepagerview/NativeScrollerView.kt +50 -6
- package/docs/SPEC.md +101 -1
- package/ios/RNCCollapsiblePagerViewComponentView.mm +124 -12
- package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +178 -0
- package/ios/tests/RNCCollapsiblePagerPressCancellationTests.mm +65 -0
- package/lib/module/CollapsiblePagerView.js +20 -4
- package/lib/module/CollapsiblePagerView.web.js +11 -2
- package/lib/module/CollapsiblePagerViewNativeComponent.ts +13 -0
- package/lib/typescript/src/CollapsiblePagerView.d.ts +6 -1
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +2 -0
- package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +5 -0
- package/package.json +2 -2
- package/src/CollapsiblePagerView.tsx +68 -4
- package/src/CollapsiblePagerView.web.tsx +19 -2
- package/src/CollapsiblePagerViewNativeComponent.ts +13 -0
|
@@ -580,6 +580,23 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
580
580
|
this.scrollCurrentPageToTop(0, options?.animated ?? true);
|
|
581
581
|
};
|
|
582
582
|
|
|
583
|
+
public scrollHeaderBy = (delta: number) => {
|
|
584
|
+
if (!Number.isFinite(delta)) return;
|
|
585
|
+
const offset = Math.min(
|
|
586
|
+
this.headerHeight,
|
|
587
|
+
Math.max(0, this.sharedHeaderOffset + delta)
|
|
588
|
+
);
|
|
589
|
+
this.scrollCurrentPageToTop(offset, false);
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
public scrollHeaderToOffset = (offset: number) => {
|
|
593
|
+
if (!Number.isFinite(offset)) return;
|
|
594
|
+
this.scrollCurrentPageToTop(
|
|
595
|
+
Math.min(this.headerHeight, Math.max(0, offset)),
|
|
596
|
+
false
|
|
597
|
+
);
|
|
598
|
+
};
|
|
599
|
+
|
|
583
600
|
public scrollToStickyTop = (options?: Readonly<{ animated?: boolean }>) => {
|
|
584
601
|
this.scrollCurrentPageToTop(
|
|
585
602
|
this.headerHeight,
|
|
@@ -674,10 +691,10 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
674
691
|
)
|
|
675
692
|
return;
|
|
676
693
|
this.pageOffsets.set(key, 0);
|
|
677
|
-
this.sharedHeaderOffset = offset;
|
|
694
|
+
this.sharedHeaderOffset = Math.min(this.headerHeight, Math.max(0, offset));
|
|
678
695
|
this.bodyAlignment = { element, key };
|
|
679
696
|
scrollElementTo(element, {
|
|
680
|
-
top:
|
|
697
|
+
top: this.sharedHeaderOffset,
|
|
681
698
|
behavior: animated ? "smooth" : "instant",
|
|
682
699
|
});
|
|
683
700
|
this.syncFallbackHeader();
|
|
@@ -67,7 +67,10 @@ export interface NativeProps extends ViewProps {
|
|
|
67
67
|
retainedPages?: string;
|
|
68
68
|
nativeTabBarItems?: string;
|
|
69
69
|
nativeTabBarHeight?: Double;
|
|
70
|
+
nativeTabBarVariant?: string;
|
|
71
|
+
nativeTabBarTrailingReservedWidth?: WithDefault<Double, 0>;
|
|
70
72
|
nativeTabBarContentPaddingHorizontal?: Double;
|
|
73
|
+
nativeTabBarContentPaddingVertical?: Double;
|
|
71
74
|
nativeTabBarItemSpacing?: Double;
|
|
72
75
|
nativeTabBarFontSize?: Double;
|
|
73
76
|
nativeTabBarFontFamily?: string;
|
|
@@ -91,6 +94,14 @@ export interface NativeProps extends ViewProps {
|
|
|
91
94
|
type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
|
|
92
95
|
|
|
93
96
|
export interface NativeCommands {
|
|
97
|
+
scrollHeaderToOffset: (
|
|
98
|
+
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
99
|
+
offset: Double
|
|
100
|
+
) => void;
|
|
101
|
+
scrollHeaderBy: (
|
|
102
|
+
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
103
|
+
delta: Double
|
|
104
|
+
) => void;
|
|
94
105
|
scrollToTop: (
|
|
95
106
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
96
107
|
target: Int32,
|
|
@@ -112,6 +123,8 @@ export interface NativeCommands {
|
|
|
112
123
|
|
|
113
124
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
114
125
|
supportedCommands: [
|
|
126
|
+
"scrollHeaderToOffset",
|
|
127
|
+
"scrollHeaderBy",
|
|
115
128
|
"scrollToTop",
|
|
116
129
|
"setPage",
|
|
117
130
|
"setPageWithoutAnimation",
|