@onekeyfe/react-native-pager-view 6.7.0-5 → 6.7.0-51
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 +694 -10
- package/ios/RNCCollapsiblePagerViewComponentView.mm +2225 -94
- package/ios/RNCNativeScrollerComponentView.h +2 -0
- package/ios/RNCNativeScrollerComponentView.mm +42 -0
- package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +594 -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
|
@@ -2,25 +2,20 @@ import type * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
codegenNativeCommands,
|
|
4
4
|
codegenNativeComponent,
|
|
5
|
+
type CodegenTypes,
|
|
5
6
|
type ColorValue,
|
|
6
7
|
type HostComponent,
|
|
7
8
|
type ViewProps,
|
|
8
9
|
} from "react-native";
|
|
9
10
|
|
|
10
|
-
import type {
|
|
11
|
-
DirectEventHandler,
|
|
12
|
-
Double,
|
|
13
|
-
Int32,
|
|
14
|
-
WithDefault,
|
|
15
|
-
} from "react-native/Libraries/Types/CodegenTypes";
|
|
16
11
|
|
|
17
12
|
export type OnPageScrollEventData = Readonly<{
|
|
18
|
-
position: Double;
|
|
19
|
-
offset: Double;
|
|
13
|
+
position: CodegenTypes.Double;
|
|
14
|
+
offset: CodegenTypes.Double;
|
|
20
15
|
}>;
|
|
21
16
|
|
|
22
17
|
export type OnPageSelectedEventData = Readonly<{
|
|
23
|
-
position: Double;
|
|
18
|
+
position: CodegenTypes.Double;
|
|
24
19
|
}>;
|
|
25
20
|
|
|
26
21
|
export type OnPageScrollStateChangedEventData = Readonly<{
|
|
@@ -28,11 +23,11 @@ export type OnPageScrollStateChangedEventData = Readonly<{
|
|
|
28
23
|
}>;
|
|
29
24
|
|
|
30
25
|
export type OnCollapsibleStateChangedEventData = Readonly<{
|
|
31
|
-
position: Int32;
|
|
32
|
-
headerOffset: Double;
|
|
33
|
-
nativePageCount: Int32;
|
|
34
|
-
attachedPageCount: Int32;
|
|
35
|
-
observedScrollableCount: Int32;
|
|
26
|
+
position: CodegenTypes.Int32;
|
|
27
|
+
headerOffset: CodegenTypes.Double;
|
|
28
|
+
nativePageCount: CodegenTypes.Int32;
|
|
29
|
+
attachedPageCount: CodegenTypes.Int32;
|
|
30
|
+
observedScrollableCount: CodegenTypes.Int32;
|
|
36
31
|
retainedPages: string;
|
|
37
32
|
reason: string;
|
|
38
33
|
pageKey: string;
|
|
@@ -40,9 +35,13 @@ export type OnCollapsibleStateChangedEventData = Readonly<{
|
|
|
40
35
|
}>;
|
|
41
36
|
|
|
42
37
|
export type OnNativeTabPressEventData = Readonly<{
|
|
43
|
-
position: Int32;
|
|
38
|
+
position: CodegenTypes.Int32;
|
|
44
39
|
key: string;
|
|
45
40
|
}>;
|
|
41
|
+
export type OnNativeToolbarPressEventData = Readonly<{
|
|
42
|
+
key: string;
|
|
43
|
+
anchorRect: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double; width: CodegenTypes.Double; height: CodegenTypes.Double }>;
|
|
44
|
+
}>;
|
|
46
45
|
export type OnScrollEdgeCapabilityEventData = Readonly<{ available: boolean }>;
|
|
47
46
|
|
|
48
47
|
/**
|
|
@@ -50,59 +49,73 @@ export type OnScrollEdgeCapabilityEventData = Readonly<{ available: boolean }>;
|
|
|
50
49
|
* CollapsiblePagerView instead of mounting this host component directly.
|
|
51
50
|
*/
|
|
52
51
|
export interface NativeProps extends ViewProps {
|
|
53
|
-
scrollEnabled?: WithDefault<boolean, true>;
|
|
54
|
-
layoutDirection?: WithDefault<"ltr" | "rtl", "ltr">;
|
|
55
|
-
initialPage?: Int32;
|
|
56
|
-
offscreenPageLimit?: Int32;
|
|
52
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
53
|
+
layoutDirection?: CodegenTypes.WithDefault<"ltr" | "rtl", "ltr">;
|
|
54
|
+
initialPage?: CodegenTypes.Int32;
|
|
55
|
+
offscreenPageLimit?: CodegenTypes.Int32;
|
|
57
56
|
// OneKey patch: Preserve nested pager gesture coordination for collapsible pages.
|
|
58
|
-
nestedScrollEnabled?: WithDefault<boolean, false>;
|
|
59
|
-
nativeSmoothHeaderScrollEnabled?: WithDefault<boolean, false>;
|
|
60
|
-
headerHeight?: Int32;
|
|
61
|
-
stickyHeaderHeight?: Int32;
|
|
62
|
-
|
|
57
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
58
|
+
nativeSmoothHeaderScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
59
|
+
headerHeight?: CodegenTypes.Int32;
|
|
60
|
+
stickyHeaderHeight?: CodegenTypes.Int32;
|
|
61
|
+
stickyHeaderHeights?: string;
|
|
62
|
+
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
63
63
|
topOverlayColorScheme?: string;
|
|
64
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
65
|
-
externalTopOverlayTag?: WithDefault<Int32, 0>;
|
|
64
|
+
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
65
|
+
externalTopOverlayTag?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
66
66
|
pageKeys?: string;
|
|
67
67
|
retainedPages?: string;
|
|
68
|
+
nativeTabBarConfig?: string;
|
|
68
69
|
nativeTabBarItems?: string;
|
|
69
|
-
nativeTabBarHeight?: Double;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
nativeTabBarHeight?: CodegenTypes.Double;
|
|
71
|
+
nativeTabBarVariant?: string;
|
|
72
|
+
nativeTabBarTrailingReservedWidth?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
73
|
+
nativeTabBarContentPaddingHorizontal?: CodegenTypes.Double;
|
|
74
|
+
nativeTabBarContentPaddingVertical?: CodegenTypes.Double;
|
|
75
|
+
nativeTabBarItemSpacing?: CodegenTypes.Double;
|
|
76
|
+
nativeTabBarFontSize?: CodegenTypes.Double;
|
|
73
77
|
nativeTabBarFontFamily?: string;
|
|
74
78
|
nativeTabBarBackgroundColor?: ColorValue;
|
|
75
79
|
nativeTabBarActiveTextColor?: ColorValue;
|
|
76
80
|
nativeTabBarInactiveTextColor?: ColorValue;
|
|
77
81
|
nativeTabBarIndicatorColor?: ColorValue;
|
|
78
|
-
nativeTabBarIndicatorHeight?: Double;
|
|
79
|
-
nativeTabBarIndicatorBottom?: Double;
|
|
82
|
+
nativeTabBarIndicatorHeight?: CodegenTypes.Double;
|
|
83
|
+
nativeTabBarIndicatorBottom?: CodegenTypes.Double;
|
|
80
84
|
nativeSubHeaderConfig?: string;
|
|
81
85
|
nativeSubHeaderSelectedBackgroundColor?: ColorValue;
|
|
82
|
-
onPageScroll?: DirectEventHandler<OnPageScrollEventData>;
|
|
83
|
-
onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
|
|
84
|
-
onPageScrollStateChanged?: DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
85
|
-
onCollapsibleStateChanged?: DirectEventHandler<OnCollapsibleStateChangedEventData>;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
onPageScroll?: CodegenTypes.DirectEventHandler<OnPageScrollEventData>;
|
|
87
|
+
onPageSelected?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
|
|
88
|
+
onPageScrollStateChanged?: CodegenTypes.DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
89
|
+
onCollapsibleStateChanged?: CodegenTypes.DirectEventHandler<OnCollapsibleStateChangedEventData>;
|
|
90
|
+
onNativeToolbarPress?: CodegenTypes.DirectEventHandler<OnNativeToolbarPressEventData>;
|
|
91
|
+
onNativeTabPress?: CodegenTypes.DirectEventHandler<OnNativeTabPressEventData>;
|
|
92
|
+
onNativeSubHeaderPress?: CodegenTypes.DirectEventHandler<OnNativeTabPressEventData>;
|
|
93
|
+
onScrollEdgeCapability?: CodegenTypes.DirectEventHandler<OnScrollEdgeCapabilityEventData>;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
|
|
92
97
|
|
|
93
98
|
export interface NativeCommands {
|
|
99
|
+
scrollHeaderToOffset: (
|
|
100
|
+
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
101
|
+
offset: CodegenTypes.Double
|
|
102
|
+
) => void;
|
|
103
|
+
scrollHeaderBy: (
|
|
104
|
+
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
105
|
+
delta: CodegenTypes.Double
|
|
106
|
+
) => void;
|
|
94
107
|
scrollToTop: (
|
|
95
108
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
96
|
-
target: Int32,
|
|
109
|
+
target: CodegenTypes.Int32,
|
|
97
110
|
animated: boolean
|
|
98
111
|
) => void;
|
|
99
112
|
setPage: (
|
|
100
113
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
101
|
-
selectedPage: Int32
|
|
114
|
+
selectedPage: CodegenTypes.Int32
|
|
102
115
|
) => void;
|
|
103
116
|
setPageWithoutAnimation: (
|
|
104
117
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
105
|
-
selectedPage: Int32
|
|
118
|
+
selectedPage: CodegenTypes.Int32
|
|
106
119
|
) => void;
|
|
107
120
|
setScrollEnabledImperatively: (
|
|
108
121
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
@@ -112,6 +125,8 @@ export interface NativeCommands {
|
|
|
112
125
|
|
|
113
126
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
114
127
|
supportedCommands: [
|
|
128
|
+
"scrollHeaderToOffset",
|
|
129
|
+
"scrollHeaderBy",
|
|
115
130
|
"scrollToTop",
|
|
116
131
|
"setPage",
|
|
117
132
|
"setPageWithoutAnimation",
|
|
@@ -9,8 +9,10 @@ export const NativeScroller = /*#__PURE__*/React.forwardRef(function NativeScrol
|
|
|
9
9
|
pagerScrollKey,
|
|
10
10
|
topOverlay: _topOverlay,
|
|
11
11
|
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
12
|
+
keyboardShouldPersistTaps,
|
|
12
13
|
...props
|
|
13
14
|
} = inputProps;
|
|
15
|
+
const persistTaps = keyboardShouldPersistTaps === true ? "always" : keyboardShouldPersistTaps === false ? "never" : keyboardShouldPersistTaps;
|
|
14
16
|
const scrollRef = React.useRef(null);
|
|
15
17
|
const setRef = React.useCallback(node => {
|
|
16
18
|
scrollRef.current = node;
|
|
@@ -32,6 +34,7 @@ export const NativeScroller = /*#__PURE__*/React.forwardRef(function NativeScrol
|
|
|
32
34
|
};
|
|
33
35
|
return /*#__PURE__*/_jsx(ScrollView, {
|
|
34
36
|
...props,
|
|
37
|
+
keyboardShouldPersistTaps: persistTaps,
|
|
35
38
|
ref: setRef,
|
|
36
39
|
...webDataProps
|
|
37
40
|
});
|
|
@@ -2,69 +2,65 @@ import type * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
codegenNativeCommands,
|
|
4
4
|
codegenNativeComponent,
|
|
5
|
+
type CodegenTypes,
|
|
5
6
|
type ColorValue,
|
|
6
7
|
type HostComponent,
|
|
7
8
|
type ViewProps,
|
|
8
9
|
} from "react-native";
|
|
9
|
-
import type {
|
|
10
|
-
DirectEventHandler,
|
|
11
|
-
Double,
|
|
12
|
-
WithDefault,
|
|
13
|
-
} from "react-native/Libraries/Types/CodegenTypes";
|
|
14
10
|
|
|
15
11
|
export type NativeScrollerScrollEvent = Readonly<{
|
|
16
12
|
contentInset: Readonly<{
|
|
17
|
-
top: Double;
|
|
18
|
-
right: Double;
|
|
19
|
-
bottom: Double;
|
|
20
|
-
left: Double;
|
|
13
|
+
top: CodegenTypes.Double;
|
|
14
|
+
right: CodegenTypes.Double;
|
|
15
|
+
bottom: CodegenTypes.Double;
|
|
16
|
+
left: CodegenTypes.Double;
|
|
21
17
|
}>;
|
|
22
|
-
contentOffset: Readonly<{ x: Double; y: Double }>;
|
|
23
|
-
contentSize: Readonly<{ width: Double; height: Double }>;
|
|
24
|
-
layoutMeasurement: Readonly<{ width: Double; height: Double }>;
|
|
25
|
-
velocity: Readonly<{ x: Double; y: Double }>;
|
|
26
|
-
targetContentOffset: Readonly<{ x: Double; y: Double }>;
|
|
27
|
-
zoomScale: Double;
|
|
18
|
+
contentOffset: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double }>;
|
|
19
|
+
contentSize: Readonly<{ width: CodegenTypes.Double; height: CodegenTypes.Double }>;
|
|
20
|
+
layoutMeasurement: Readonly<{ width: CodegenTypes.Double; height: CodegenTypes.Double }>;
|
|
21
|
+
velocity: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double }>;
|
|
22
|
+
targetContentOffset: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double }>;
|
|
23
|
+
zoomScale: CodegenTypes.Double;
|
|
28
24
|
}>;
|
|
29
25
|
|
|
30
26
|
export interface NativeProps extends ViewProps {
|
|
31
|
-
contentWidth?: WithDefault<Double, 0>;
|
|
32
|
-
contentHeight?: WithDefault<Double, 0>;
|
|
33
|
-
scrollEnabled?: WithDefault<boolean, true>;
|
|
34
|
-
nestedScrollEnabled?: WithDefault<boolean, true>;
|
|
35
|
-
showsVerticalScrollIndicator?: WithDefault<boolean, true>;
|
|
36
|
-
showsHorizontalScrollIndicator?: WithDefault<boolean, false>;
|
|
37
|
-
bounces?: WithDefault<boolean, true>;
|
|
38
|
-
alwaysBounceVertical?: WithDefault<boolean, true>;
|
|
39
|
-
keyboardDismissMode?: WithDefault<"none" | "on-drag" | "interactive", "none">;
|
|
40
|
-
keyboardShouldPersistTaps?: WithDefault<
|
|
27
|
+
contentWidth?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
28
|
+
contentHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
29
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
30
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
31
|
+
showsVerticalScrollIndicator?: CodegenTypes.WithDefault<boolean, true>;
|
|
32
|
+
showsHorizontalScrollIndicator?: CodegenTypes.WithDefault<boolean, false>;
|
|
33
|
+
bounces?: CodegenTypes.WithDefault<boolean, true>;
|
|
34
|
+
alwaysBounceVertical?: CodegenTypes.WithDefault<boolean, true>;
|
|
35
|
+
keyboardDismissMode?: CodegenTypes.WithDefault<"none" | "on-drag" | "interactive", "none">;
|
|
36
|
+
keyboardShouldPersistTaps?: CodegenTypes.WithDefault<
|
|
41
37
|
"never" | "always" | "handled",
|
|
42
38
|
"never"
|
|
43
39
|
>;
|
|
44
|
-
scrollEventThrottle?: WithDefault<Double, 0>;
|
|
45
|
-
decelerationRate?: WithDefault<Double, 0.998>;
|
|
46
|
-
contentInsetTop?: WithDefault<Double, 0>;
|
|
47
|
-
contentInsetRight?: WithDefault<Double, 0>;
|
|
48
|
-
contentInsetBottom?: WithDefault<Double, 0>;
|
|
49
|
-
contentInsetLeft?: WithDefault<Double, 0>;
|
|
50
|
-
topScrollEdgeEffect?: WithDefault<"none" | "hard" | "soft", "none">;
|
|
51
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
52
|
-
refreshEnabled?: WithDefault<boolean, false>;
|
|
53
|
-
refreshing?: WithDefault<boolean, false>;
|
|
40
|
+
scrollEventThrottle?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
41
|
+
decelerationRate?: CodegenTypes.WithDefault<CodegenTypes.Double, 0.998>;
|
|
42
|
+
contentInsetTop?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
43
|
+
contentInsetRight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
44
|
+
contentInsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
45
|
+
contentInsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
46
|
+
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
47
|
+
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
48
|
+
refreshEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
49
|
+
refreshing?: CodegenTypes.WithDefault<boolean, false>;
|
|
54
50
|
refreshTintColor?: ColorValue;
|
|
55
51
|
refreshColors?: ReadonlyArray<ColorValue>;
|
|
56
52
|
refreshProgressBackgroundColor?: ColorValue;
|
|
57
|
-
refreshProgressViewOffset?: WithDefault<Double, 0>;
|
|
53
|
+
refreshProgressViewOffset?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
58
54
|
refreshTitle?: string;
|
|
59
55
|
refreshTitleColor?: ColorValue;
|
|
60
|
-
refreshSize?: WithDefault<"default" | "large", "default">;
|
|
61
|
-
onContentViewportChange?: DirectEventHandler<Readonly<{ height: Double }>>;
|
|
62
|
-
onRefresh?: DirectEventHandler<null>;
|
|
63
|
-
onScroll?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
64
|
-
onScrollBeginDrag?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
65
|
-
onScrollEndDrag?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
66
|
-
onMomentumScrollBegin?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
67
|
-
onMomentumScrollEnd?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
56
|
+
refreshSize?: CodegenTypes.WithDefault<"default" | "large", "default">;
|
|
57
|
+
onContentViewportChange?: CodegenTypes.DirectEventHandler<Readonly<{ height: CodegenTypes.Double }>>;
|
|
58
|
+
onRefresh?: CodegenTypes.DirectEventHandler<null>;
|
|
59
|
+
onScroll?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
60
|
+
onScrollBeginDrag?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
61
|
+
onScrollEndDrag?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
62
|
+
onMomentumScrollBegin?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
63
|
+
onMomentumScrollEnd?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
type NativeScrollerHost = HostComponent<NativeProps>;
|
|
@@ -72,8 +68,8 @@ type NativeScrollerHost = HostComponent<NativeProps>;
|
|
|
72
68
|
export interface NativeCommands {
|
|
73
69
|
scrollTo: (
|
|
74
70
|
viewRef: React.ElementRef<NativeScrollerHost>,
|
|
75
|
-
x: Double,
|
|
76
|
-
y: Double,
|
|
71
|
+
x: CodegenTypes.Double,
|
|
72
|
+
y: CodegenTypes.Double,
|
|
77
73
|
animated: boolean
|
|
78
74
|
) => void;
|
|
79
75
|
scrollToEnd: (
|
|
@@ -2,24 +2,19 @@ import type * as React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
codegenNativeCommands,
|
|
4
4
|
codegenNativeComponent,
|
|
5
|
+
type CodegenTypes,
|
|
5
6
|
type HostComponent,
|
|
6
7
|
type ViewProps,
|
|
7
8
|
} from 'react-native';
|
|
8
9
|
|
|
9
|
-
import type {
|
|
10
|
-
DirectEventHandler,
|
|
11
|
-
Double,
|
|
12
|
-
Int32,
|
|
13
|
-
WithDefault,
|
|
14
|
-
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
15
10
|
|
|
16
11
|
export type OnPageScrollEventData = Readonly<{
|
|
17
|
-
position: Double;
|
|
18
|
-
offset: Double;
|
|
12
|
+
position: CodegenTypes.Double;
|
|
13
|
+
offset: CodegenTypes.Double;
|
|
19
14
|
}>;
|
|
20
15
|
|
|
21
16
|
export type OnPageSelectedEventData = Readonly<{
|
|
22
|
-
position: Double;
|
|
17
|
+
position: CodegenTypes.Double;
|
|
23
18
|
}>;
|
|
24
19
|
|
|
25
20
|
export type OnPageScrollStateChangedEventData = Readonly<{
|
|
@@ -27,32 +22,32 @@ export type OnPageScrollStateChangedEventData = Readonly<{
|
|
|
27
22
|
}>;
|
|
28
23
|
|
|
29
24
|
export interface NativeProps extends ViewProps {
|
|
30
|
-
scrollEnabled?: WithDefault<boolean, true>;
|
|
31
|
-
layoutDirection?: WithDefault<'ltr' | 'rtl', 'ltr'>;
|
|
32
|
-
initialPage?: Int32;
|
|
33
|
-
orientation?: WithDefault<'horizontal' | 'vertical', 'horizontal'>;
|
|
34
|
-
offscreenPageLimit?: Int32;
|
|
35
|
-
pageMargin?: Int32;
|
|
36
|
-
overScrollMode?: WithDefault<'auto' | 'always' | 'never', 'auto'>;
|
|
37
|
-
overdrag?: WithDefault<boolean, false>;
|
|
38
|
-
keyboardDismissMode?: WithDefault<'none' | 'on-drag', 'none'>;
|
|
25
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
26
|
+
layoutDirection?: CodegenTypes.WithDefault<'ltr' | 'rtl', 'ltr'>;
|
|
27
|
+
initialPage?: CodegenTypes.Int32;
|
|
28
|
+
orientation?: CodegenTypes.WithDefault<'horizontal' | 'vertical', 'horizontal'>;
|
|
29
|
+
offscreenPageLimit?: CodegenTypes.Int32;
|
|
30
|
+
pageMargin?: CodegenTypes.Int32;
|
|
31
|
+
overScrollMode?: CodegenTypes.WithDefault<'auto' | 'always' | 'never', 'auto'>;
|
|
32
|
+
overdrag?: CodegenTypes.WithDefault<boolean, false>;
|
|
33
|
+
keyboardDismissMode?: CodegenTypes.WithDefault<'none' | 'on-drag', 'none'>;
|
|
39
34
|
/**
|
|
40
35
|
* Controls the sensitivity of scroll gestures on Android.
|
|
41
36
|
* Higher values make scrolling less sensitive.
|
|
42
37
|
* Valid range: 2 - 8
|
|
43
38
|
* @platform android
|
|
44
39
|
*/
|
|
45
|
-
scrollSensitivity?: Int32;
|
|
40
|
+
scrollSensitivity?: CodegenTypes.Int32;
|
|
46
41
|
/**
|
|
47
42
|
* When true on an inner PagerView, enables gesture coordination with
|
|
48
43
|
* a parent (outer) PagerView. At sub-tab boundaries the inner pager's
|
|
49
44
|
* gesture recognizer will not begin, allowing the outer pager to take over.
|
|
50
45
|
* @platform ios
|
|
51
46
|
*/
|
|
52
|
-
nestedScrollEnabled?: WithDefault<boolean, false>;
|
|
53
|
-
onPageScroll?: DirectEventHandler<OnPageScrollEventData>;
|
|
54
|
-
onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
|
|
55
|
-
onPageScrollStateChanged?: DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
47
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
48
|
+
onPageScroll?: CodegenTypes.DirectEventHandler<OnPageScrollEventData>;
|
|
49
|
+
onPageSelected?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
|
|
50
|
+
onPageScrollStateChanged?: CodegenTypes.DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
type PagerViewViewType = HostComponent<NativeProps>;
|
|
@@ -60,11 +55,11 @@ type PagerViewViewType = HostComponent<NativeProps>;
|
|
|
60
55
|
export interface NativeCommands {
|
|
61
56
|
setPage: (
|
|
62
57
|
viewRef: React.ElementRef<PagerViewViewType>,
|
|
63
|
-
selectedPage: Int32
|
|
58
|
+
selectedPage: CodegenTypes.Int32
|
|
64
59
|
) => void;
|
|
65
60
|
setPageWithoutAnimation: (
|
|
66
61
|
viewRef: React.ElementRef<PagerViewViewType>,
|
|
67
|
-
selectedPage: Int32
|
|
62
|
+
selectedPage: CodegenTypes.Int32
|
|
68
63
|
) => void;
|
|
69
64
|
setScrollEnabledImperatively: (
|
|
70
65
|
viewRef: React.ElementRef<PagerViewViewType>,
|
|
@@ -148,7 +148,12 @@ export function WebCollapsiblePagerPage({
|
|
|
148
148
|
owner.addEventListener("keydown", handleKey);
|
|
149
149
|
owner.addEventListener("ok-collapsible-pager-user-scroll", handleUserInput);
|
|
150
150
|
owner.addEventListener("ok-collapsible-pager-insets-changed", requestMeasure);
|
|
151
|
-
|
|
151
|
+
// Measure synchronously while still inside the layout phase: the metrics
|
|
152
|
+
// start at width 0, and deferring this first measurement to the next
|
|
153
|
+
// animation frame let the page paint once at width 0, which collapsed
|
|
154
|
+
// shrinkable page content (a fiat hero wrapped one character per line,
|
|
155
|
+
// OK-66299). Resize and scroll updates stay frame-coalesced.
|
|
156
|
+
measure();
|
|
152
157
|
return () => {
|
|
153
158
|
observer.disconnect();
|
|
154
159
|
observerRef.current = null;
|
|
@@ -162,7 +167,7 @@ export function WebCollapsiblePagerPage({
|
|
|
162
167
|
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
163
168
|
frameRef.current = null;
|
|
164
169
|
};
|
|
165
|
-
}, [owner, requestMeasure, syncContentObservation]);
|
|
170
|
+
}, [owner, measure, requestMeasure, syncContentObservation]);
|
|
166
171
|
React.useLayoutEffect(requestMeasure, [isFocused, isRouteActive, headerHeight, stickyHeaderHeight, requestMeasure]);
|
|
167
172
|
const value = React.useMemo(() => ({
|
|
168
173
|
isFocused,
|
|
@@ -16,19 +16,69 @@ export type CollapsiblePagerNativeTabBarItem = Readonly<{
|
|
|
16
16
|
testID?: string;
|
|
17
17
|
}>;
|
|
18
18
|
export type CollapsiblePagerNativeTabBarStyle = Readonly<{
|
|
19
|
+
/**
|
|
20
|
+
* `pill` draws a rounded background behind the selected item that follows
|
|
21
|
+
* pager progress, with active / inactive label colors.
|
|
22
|
+
*/
|
|
23
|
+
variant?: "underline" | "segmented" | "text" | "pill";
|
|
19
24
|
height?: number;
|
|
25
|
+
trailingReservedWidth?: number;
|
|
20
26
|
contentPaddingHorizontal?: number;
|
|
27
|
+
contentPaddingVertical?: number;
|
|
21
28
|
itemSpacing?: number;
|
|
22
29
|
fontSize?: number;
|
|
23
30
|
fontFamily?: string;
|
|
31
|
+
activeFontFamily?: string;
|
|
24
32
|
backgroundColor?: ReactNative.ColorValue;
|
|
25
33
|
activeTextColor?: ReactNative.ColorValue;
|
|
26
34
|
inactiveTextColor?: ReactNative.ColorValue;
|
|
27
35
|
indicatorColor?: ReactNative.ColorValue;
|
|
28
36
|
indicatorHeight?: number;
|
|
29
37
|
indicatorBottom?: number;
|
|
38
|
+
/** Horizontal padding inside each item. Defaults: text 10, pill 14, others 8. */
|
|
39
|
+
itemPaddingHorizontal?: number;
|
|
40
|
+
/** Pill variant: background of an unselected item under the pointer. */
|
|
41
|
+
itemHoverBackgroundColor?: ReactNative.ColorValue;
|
|
42
|
+
/** Pill variant: background of an unselected item while pressed. */
|
|
43
|
+
itemPressedBackgroundColor?: ReactNative.ColorValue;
|
|
44
|
+
/**
|
|
45
|
+
* Caps the width of the tab row and toolbar and centers them; the bar
|
|
46
|
+
* background still spans the full width.
|
|
47
|
+
*/
|
|
48
|
+
contentMaxWidth?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Pill variant: when false, the pill and label colors jump to the selected
|
|
51
|
+
* item instead of following pager progress or animating. Defaults to true.
|
|
52
|
+
*/
|
|
53
|
+
indicatorAnimationEnabled?: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
export type CollapsiblePagerToolbarItem = Readonly<{
|
|
56
|
+
iconName: string;
|
|
57
|
+
selected?: boolean;
|
|
58
|
+
accessibilityLabel?: string;
|
|
59
|
+
testID?: string;
|
|
60
|
+
iconColor?: string;
|
|
61
|
+
selectedBackgroundColor?: string;
|
|
62
|
+
hoverBackgroundColor?: string;
|
|
63
|
+
pressedBackgroundColor?: string;
|
|
64
|
+
size?: number;
|
|
65
|
+
iconSize?: number;
|
|
66
|
+
contentWidth?: number;
|
|
67
|
+
trailingInset?: number;
|
|
68
|
+
}>;
|
|
69
|
+
export type CollapsiblePagerToolbarPress = Readonly<{
|
|
70
|
+
key: string;
|
|
71
|
+
anchorRect: Readonly<{
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
}>;
|
|
30
77
|
}>;
|
|
31
78
|
export type CollapsiblePagerNativeTabBarConfig = Readonly<{
|
|
79
|
+
controlled?: boolean;
|
|
80
|
+
selectedKey?: string;
|
|
81
|
+
toolbar?: Readonly<Record<string, CollapsiblePagerToolbarItem>>;
|
|
32
82
|
items: readonly CollapsiblePagerNativeTabBarItem[];
|
|
33
83
|
style?: CollapsiblePagerNativeTabBarStyle;
|
|
34
84
|
}>;
|
|
@@ -56,7 +106,7 @@ export type CollapsiblePagerNativeSubHeaderConfig = Readonly<{
|
|
|
56
106
|
}>;
|
|
57
107
|
export type CollapsiblePagerViewOnNativeTabPressEvent = ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>;
|
|
58
108
|
export type CollapsiblePagerViewOnNativeSubHeaderPressEvent = ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>;
|
|
59
|
-
export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children" | "headerHeight" | "stickyHeaderHeight" | "topScrollEdgeEffect" | "topOverlayHeight" | "externalTopOverlayTag" | "pageKeys" | "retainedPages" | "nativeTabBarItems" | "nativeTabBarHeight" | "nativeTabBarContentPaddingHorizontal" | "nativeTabBarItemSpacing" | "nativeTabBarFontSize" | "nativeTabBarFontFamily" | "nativeTabBarBackgroundColor" | "nativeTabBarActiveTextColor" | "nativeTabBarInactiveTextColor" | "nativeTabBarIndicatorColor" | "nativeTabBarIndicatorHeight" | "nativeTabBarIndicatorBottom" | "nativeSubHeaderConfig" | "nativeSubHeaderSelectedBackgroundColor" | "onNativeTabPress" | "onNativeSubHeaderPress" | "layoutDirection"> {
|
|
109
|
+
export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children" | "headerHeight" | "stickyHeaderHeight" | "stickyHeaderHeights" | "topScrollEdgeEffect" | "topOverlayHeight" | "externalTopOverlayTag" | "pageKeys" | "retainedPages" | "nativeTabBarConfig" | "onNativeToolbarPress" | "nativeTabBarItems" | "nativeTabBarHeight" | "nativeTabBarVariant" | "nativeTabBarTrailingReservedWidth" | "nativeTabBarContentPaddingHorizontal" | "nativeTabBarContentPaddingVertical" | "nativeTabBarItemSpacing" | "nativeTabBarFontSize" | "nativeTabBarFontFamily" | "nativeTabBarBackgroundColor" | "nativeTabBarActiveTextColor" | "nativeTabBarInactiveTextColor" | "nativeTabBarIndicatorColor" | "nativeTabBarIndicatorHeight" | "nativeTabBarIndicatorBottom" | "nativeSubHeaderConfig" | "nativeSubHeaderSelectedBackgroundColor" | "onNativeTabPress" | "onNativeSubHeaderPress" | "layoutDirection"> {
|
|
60
110
|
/** Collapsible content rendered above the sticky bar. */
|
|
61
111
|
header: React.ReactNode;
|
|
62
112
|
/** Bar which remains pinned after the header has collapsed. */
|
|
@@ -65,8 +115,12 @@ export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children"
|
|
|
65
115
|
headerHeight: number;
|
|
66
116
|
/** Measured sticky bar height. */
|
|
67
117
|
stickyHeaderHeight: number;
|
|
118
|
+
/** iOS only. Sticky heights in child order, applied before each page is displayed. */
|
|
119
|
+
stickyHeaderHeights?: readonly number[];
|
|
68
120
|
/** Fixed content above the collapsible header on iOS 26 and newer. */
|
|
69
121
|
topOverlay?: React.ReactNode;
|
|
122
|
+
/** Known overlay height to reserve until its first layout measurement. */
|
|
123
|
+
topOverlayHeightHint?: number;
|
|
70
124
|
/** Existing fixed header shared with a parent pager on iOS 26 and newer. */
|
|
71
125
|
externalTopOverlayTag?: number;
|
|
72
126
|
/** Selects UIKit's top scroll-edge effect on iOS 26 and newer. */
|
|
@@ -87,6 +141,7 @@ export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children"
|
|
|
87
141
|
layoutDirection?: "ltr" | "rtl" | "locale";
|
|
88
142
|
/** Optional native tab bar for iOS and Android. */
|
|
89
143
|
nativeTabBar?: CollapsiblePagerNativeTabBarConfig;
|
|
144
|
+
onNativeToolbarPress?: (event: ReactNative.NativeSyntheticEvent<CollapsiblePagerToolbarPress>) => void;
|
|
90
145
|
onNativeTabPress?: (event: CollapsiblePagerViewOnNativeTabPressEvent) => void;
|
|
91
146
|
/**
|
|
92
147
|
* Defaults to animating adjacent native tab presses and jumping directly to
|
|
@@ -102,7 +157,7 @@ export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children"
|
|
|
102
157
|
type State = {
|
|
103
158
|
selectedPage: number;
|
|
104
159
|
transientRetainedPages: readonly number[];
|
|
105
|
-
topOverlayHeight: number;
|
|
160
|
+
topOverlayHeight: number | null;
|
|
106
161
|
};
|
|
107
162
|
/**
|
|
108
163
|
* Pager variant whose vertical header coordination is performed by the native
|
|
@@ -120,12 +175,14 @@ export declare class CollapsiblePagerView extends React.PureComponent<Collapsibl
|
|
|
120
175
|
private nativePagerScrollState;
|
|
121
176
|
private nativeTabCommandQueuedDuringScroll;
|
|
122
177
|
componentDidMount(): void;
|
|
123
|
-
componentDidUpdate(): void;
|
|
178
|
+
componentDidUpdate(previousProps: CollapsiblePagerViewProps): void;
|
|
124
179
|
setPage: (selectedPage: number) => void;
|
|
125
180
|
setPageWithoutAnimation: (selectedPage: number) => void;
|
|
126
181
|
scrollToPageTop: (options?: Readonly<{
|
|
127
182
|
animated?: boolean;
|
|
128
183
|
}>) => void;
|
|
184
|
+
scrollHeaderBy: (delta: number) => void;
|
|
185
|
+
scrollHeaderToOffset: (offset: number) => void;
|
|
129
186
|
scrollToStickyTop: (options?: Readonly<{
|
|
130
187
|
animated?: boolean;
|
|
131
188
|
}>) => void;
|
|
@@ -139,8 +196,9 @@ export declare class CollapsiblePagerView extends React.PureComponent<Collapsibl
|
|
|
139
196
|
private onPageSelected;
|
|
140
197
|
private onPageScrollStateChanged;
|
|
141
198
|
private onNativeTabPress;
|
|
199
|
+
private onNativeToolbarPress;
|
|
142
200
|
private onNativeSubHeaderPress;
|
|
143
|
-
render():
|
|
201
|
+
render(): React.JSX.Element;
|
|
144
202
|
}
|
|
145
203
|
export type CollapsiblePagerViewOnPageScrollEvent = ReactNative.NativeSyntheticEvent<OnPageScrollEventData>;
|
|
146
204
|
export type CollapsiblePagerViewOnPageSelectedEvent = ReactNative.NativeSyntheticEvent<OnPageSelectedEventData>;
|