@onekeyfe/react-native-pager-view 3.0.179-alpha.2026101503 → 3.0.179-alpha.302
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/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +0 -10
- package/android/src/main/java/com/reactnativepagerview/NativeScrollerViewManager.kt +0 -4
- package/docs/SPEC.md +1 -77
- package/ios/RNCCollapsiblePagerViewComponentView.mm +138 -838
- package/ios/RNCNativeScrollerComponentView.mm +38 -93
- package/ios/RNCPagerViewComponentView.h +0 -7
- package/ios/RNCPagerViewComponentView.mm +0 -34
- package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +0 -49
- package/lib/module/CollapsiblePagerView.js +1 -27
- package/lib/module/CollapsiblePagerView.web.js +0 -4
- package/lib/module/CollapsiblePagerViewNativeComponent.ts +0 -6
- package/lib/module/NativeScroller.js +82 -105
- package/lib/module/NativeScroller.web.js +0 -2
- package/lib/module/NativeScrollerNativeComponent.ts +0 -2
- package/lib/typescript/src/CollapsiblePagerView.d.ts +1 -10
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +0 -4
- package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +0 -8
- package/lib/typescript/src/NativeScroller.d.ts +0 -4
- package/lib/typescript/src/NativeScrollerNativeComponent.d.ts +0 -2
- package/package.json +2 -2
- package/src/CollapsiblePagerView.tsx +0 -44
- package/src/CollapsiblePagerView.web.tsx +0 -8
- package/src/CollapsiblePagerViewNativeComponent.ts +0 -6
- package/src/NativeScroller.tsx +2 -27
- package/src/NativeScroller.web.tsx +0 -2
- package/src/NativeScrollerNativeComponent.ts +0 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { findNodeHandle, Keyboard, Platform, StyleSheet, TextInput, View } from "react-native";
|
|
5
5
|
import NativeScrollerHost, { Commands } from "./NativeScrollerNativeComponent";
|
|
6
|
-
import { jsx as _jsx
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export const NATIVE_SCROLLER_NATIVE_ID_PREFIX = "rnc-collapsible-pager-native-scroller";
|
|
8
8
|
|
|
9
9
|
/** Supported vertical subset; horizontal, snapping, zoom and sticky rows are not supported. */
|
|
@@ -27,8 +27,6 @@ const styles = StyleSheet.create({
|
|
|
27
27
|
});
|
|
28
28
|
export const NativeScroller = /*#__PURE__*/React.forwardRef(function NativeScroller({
|
|
29
29
|
children,
|
|
30
|
-
topOverlay,
|
|
31
|
-
topScrollEdgeEffect,
|
|
32
30
|
nativeID,
|
|
33
31
|
pagerScrollKey,
|
|
34
32
|
style,
|
|
@@ -58,8 +56,6 @@ export const NativeScroller = /*#__PURE__*/React.forwardRef(function NativeScrol
|
|
|
58
56
|
width: 0,
|
|
59
57
|
height: 0
|
|
60
58
|
});
|
|
61
|
-
const [topOverlayHeight, setTopOverlayHeight] = React.useState(0);
|
|
62
|
-
const hasTopOverlay = Platform.OS === "ios" && parseInt(String(Platform.Version), 10) >= 26 && topScrollEdgeEffect === "hard" && topOverlay != null;
|
|
63
59
|
const [refreshEpoch, requestRefreshSync] = React.useReducer(value => value + 1, 0);
|
|
64
60
|
const contentSizeRef = React.useRef(contentSize);
|
|
65
61
|
const scrolledSinceGrant = React.useRef(false);
|
|
@@ -98,111 +94,92 @@ export const NativeScroller = /*#__PURE__*/React.forwardRef(function NativeScrol
|
|
|
98
94
|
blur: () => hostRef.current?.blur()
|
|
99
95
|
}), []);
|
|
100
96
|
const keyboardIsDismissible = () => Boolean(TextInput.State.currentlyFocusedInput() && (Keyboard.isVisible() || Platform.OS === "android" && Number(Platform.Version) < 30) && Keyboard.metrics()?.height !== 0);
|
|
101
|
-
return /*#__PURE__*/
|
|
102
|
-
|
|
97
|
+
return /*#__PURE__*/_jsx(NativeScrollerHost, {
|
|
98
|
+
...props,
|
|
99
|
+
ref: hostRef,
|
|
100
|
+
nativeID: `${NATIVE_SCROLLER_NATIVE_ID_PREFIX}:${pagerScrollKey ?? nativeID ?? generatedId}`,
|
|
103
101
|
style: [styles.viewport, style],
|
|
102
|
+
nestedScrollEnabled: nestedScrollEnabled,
|
|
103
|
+
contentWidth: contentSize.width,
|
|
104
|
+
contentHeight: contentSize.height,
|
|
105
|
+
contentInsetTop: contentInset?.top ?? 0,
|
|
106
|
+
contentInsetRight: contentInset?.right ?? 0,
|
|
107
|
+
contentInsetBottom: contentInset?.bottom ?? 0,
|
|
108
|
+
contentInsetLeft: contentInset?.left ?? 0,
|
|
109
|
+
decelerationRate: rate,
|
|
110
|
+
keyboardShouldPersistTaps: persistTaps,
|
|
111
|
+
refreshEnabled: Boolean(refresh) && refresh?.enabled !== false,
|
|
112
|
+
refreshing: refresh?.refreshing ?? false,
|
|
113
|
+
refreshTintColor: refresh?.tintColor,
|
|
114
|
+
refreshColors: refresh?.colors,
|
|
115
|
+
refreshProgressBackgroundColor: refresh?.progressBackgroundColor,
|
|
116
|
+
refreshProgressViewOffset: refresh?.progressViewOffset ?? 0,
|
|
117
|
+
refreshTitle: refresh?.title,
|
|
118
|
+
refreshTitleColor: refresh?.titleColor,
|
|
119
|
+
refreshSize: refresh?.size === "large" ? "large" : "default",
|
|
120
|
+
onRefresh: () => {
|
|
121
|
+
try {
|
|
122
|
+
refresh?.onRefresh?.();
|
|
123
|
+
} finally {
|
|
124
|
+
requestRefreshSync();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
104
127
|
onLayout: onLayout,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (!Number.isFinite(height) || height < 0) return;
|
|
140
|
-
setContentViewportHeight(previous => previous === height ? previous : height);
|
|
141
|
-
},
|
|
142
|
-
onScroll: event => {
|
|
143
|
-
scrolledSinceGrant.current = true;
|
|
144
|
-
onScroll?.(event);
|
|
145
|
-
},
|
|
146
|
-
onScrollBeginDrag: event => {
|
|
147
|
-
scrolledSinceGrant.current = true;
|
|
148
|
-
onScrollBeginDrag?.(event);
|
|
149
|
-
},
|
|
150
|
-
onMomentumScrollBegin: event => {
|
|
151
|
-
momentum.current = true;
|
|
152
|
-
onMomentumScrollBegin?.(event);
|
|
153
|
-
},
|
|
154
|
-
onMomentumScrollEnd: event => {
|
|
155
|
-
momentum.current = false;
|
|
156
|
-
onMomentumScrollEnd?.(event);
|
|
157
|
-
},
|
|
158
|
-
onStartShouldSetResponder: event => onStartShouldSetResponder?.(event) ?? (persistTaps === "handled" && keyboardIsDismissible() && event.target !== TextInput.State.currentlyFocusedInput()),
|
|
159
|
-
onStartShouldSetResponderCapture: event => onStartShouldSetResponderCapture?.(event) ?? (momentum.current || persistTaps === "never" && keyboardIsDismissible() && typeof event.target !== "number" && !textInputState.isTextInput(event.target)),
|
|
160
|
-
onResponderGrant: event => {
|
|
161
|
-
scrolledSinceGrant.current = false;
|
|
162
|
-
grantedDuringMomentum.current = momentum.current;
|
|
163
|
-
onResponderGrant?.(event);
|
|
164
|
-
},
|
|
165
|
-
onResponderRelease: event => {
|
|
166
|
-
onResponderRelease?.(event);
|
|
167
|
-
if (persistTaps !== "always" && keyboardIsDismissible() && event.target !== TextInput.State.currentlyFocusedInput() && !scrolledSinceGrant.current && !grantedDuringMomentum.current) Keyboard.dismiss();
|
|
168
|
-
},
|
|
169
|
-
onResponderTerminationRequest: event => onResponderTerminationRequest?.(event) ?? true,
|
|
170
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
171
|
-
collapsable: false,
|
|
172
|
-
style: [contentContainerStyle, (contentStyle?.flexGrow ?? 0) > 0 && (contentStyle?.minHeight === undefined || typeof contentStyle.minHeight === "number") ? {
|
|
173
|
-
minHeight: Math.max(contentViewportHeight, contentStyle?.minHeight ?? 0)
|
|
174
|
-
} : undefined, styles.content],
|
|
175
|
-
onLayout: event => {
|
|
176
|
-
const {
|
|
177
|
-
width,
|
|
178
|
-
height
|
|
179
|
-
} = event.nativeEvent.layout;
|
|
180
|
-
const previous = contentSizeRef.current;
|
|
181
|
-
if (previous.width === width && previous.height === height) return;
|
|
182
|
-
const next = {
|
|
183
|
-
width,
|
|
184
|
-
height
|
|
185
|
-
};
|
|
186
|
-
contentSizeRef.current = next;
|
|
187
|
-
setContentSize(next);
|
|
188
|
-
onContentSizeChange?.(width, height);
|
|
189
|
-
},
|
|
190
|
-
children: children
|
|
191
|
-
})
|
|
192
|
-
}), hasTopOverlay ? /*#__PURE__*/_jsx(View, {
|
|
128
|
+
onContentViewportChange: event => {
|
|
129
|
+
const height = event.nativeEvent.height;
|
|
130
|
+
if (!Number.isFinite(height) || height < 0) return;
|
|
131
|
+
setContentViewportHeight(previous => previous === height ? previous : height);
|
|
132
|
+
},
|
|
133
|
+
onScroll: event => {
|
|
134
|
+
scrolledSinceGrant.current = true;
|
|
135
|
+
onScroll?.(event);
|
|
136
|
+
},
|
|
137
|
+
onScrollBeginDrag: event => {
|
|
138
|
+
scrolledSinceGrant.current = true;
|
|
139
|
+
onScrollBeginDrag?.(event);
|
|
140
|
+
},
|
|
141
|
+
onMomentumScrollBegin: event => {
|
|
142
|
+
momentum.current = true;
|
|
143
|
+
onMomentumScrollBegin?.(event);
|
|
144
|
+
},
|
|
145
|
+
onMomentumScrollEnd: event => {
|
|
146
|
+
momentum.current = false;
|
|
147
|
+
onMomentumScrollEnd?.(event);
|
|
148
|
+
},
|
|
149
|
+
onStartShouldSetResponder: event => onStartShouldSetResponder?.(event) ?? (persistTaps === "handled" && keyboardIsDismissible() && event.target !== TextInput.State.currentlyFocusedInput()),
|
|
150
|
+
onStartShouldSetResponderCapture: event => onStartShouldSetResponderCapture?.(event) ?? (momentum.current || persistTaps === "never" && keyboardIsDismissible() && typeof event.target !== "number" && !textInputState.isTextInput(event.target)),
|
|
151
|
+
onResponderGrant: event => {
|
|
152
|
+
scrolledSinceGrant.current = false;
|
|
153
|
+
grantedDuringMomentum.current = momentum.current;
|
|
154
|
+
onResponderGrant?.(event);
|
|
155
|
+
},
|
|
156
|
+
onResponderRelease: event => {
|
|
157
|
+
onResponderRelease?.(event);
|
|
158
|
+
if (persistTaps !== "always" && keyboardIsDismissible() && event.target !== TextInput.State.currentlyFocusedInput() && !scrolledSinceGrant.current && !grantedDuringMomentum.current) Keyboard.dismiss();
|
|
159
|
+
},
|
|
160
|
+
onResponderTerminationRequest: event => onResponderTerminationRequest?.(event) ?? true,
|
|
161
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
193
162
|
collapsable: false,
|
|
194
|
-
style: {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
left: 0,
|
|
198
|
-
right: 0
|
|
199
|
-
},
|
|
163
|
+
style: [contentContainerStyle, (contentStyle?.flexGrow ?? 0) > 0 && (contentStyle?.minHeight === undefined || typeof contentStyle.minHeight === "number") ? {
|
|
164
|
+
minHeight: Math.max(contentViewportHeight, contentStyle?.minHeight ?? 0)
|
|
165
|
+
} : undefined, styles.content],
|
|
200
166
|
onLayout: event => {
|
|
201
|
-
const
|
|
202
|
-
|
|
167
|
+
const {
|
|
168
|
+
width,
|
|
169
|
+
height
|
|
170
|
+
} = event.nativeEvent.layout;
|
|
171
|
+
const previous = contentSizeRef.current;
|
|
172
|
+
if (previous.width === width && previous.height === height) return;
|
|
173
|
+
const next = {
|
|
174
|
+
width,
|
|
175
|
+
height
|
|
176
|
+
};
|
|
177
|
+
contentSizeRef.current = next;
|
|
178
|
+
setContentSize(next);
|
|
179
|
+
onContentSizeChange?.(width, height);
|
|
203
180
|
},
|
|
204
|
-
children:
|
|
205
|
-
})
|
|
181
|
+
children: children
|
|
182
|
+
})
|
|
206
183
|
});
|
|
207
184
|
});
|
|
208
185
|
NativeScroller.displayName = "NativeScroller";
|
|
@@ -7,8 +7,6 @@ export const NativeScroller = /*#__PURE__*/React.forwardRef(function NativeScrol
|
|
|
7
7
|
const {
|
|
8
8
|
dataSet,
|
|
9
9
|
pagerScrollKey: _pagerScrollKey,
|
|
10
|
-
topOverlay: _topOverlay,
|
|
11
|
-
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
12
10
|
...props
|
|
13
11
|
} = inputProps;
|
|
14
12
|
const webDataProps = {
|
|
@@ -47,8 +47,6 @@ export interface NativeProps extends ViewProps {
|
|
|
47
47
|
contentInsetRight?: WithDefault<Double, 0>;
|
|
48
48
|
contentInsetBottom?: WithDefault<Double, 0>;
|
|
49
49
|
contentInsetLeft?: WithDefault<Double, 0>;
|
|
50
|
-
topScrollEdgeHard?: WithDefault<boolean, false>;
|
|
51
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
52
50
|
refreshEnabled?: WithDefault<boolean, false>;
|
|
53
51
|
refreshing?: WithDefault<boolean, false>;
|
|
54
52
|
refreshTintColor?: ColorValue;
|
|
@@ -55,7 +55,7 @@ export type CollapsiblePagerNativeSubHeaderConfig = Readonly<{
|
|
|
55
55
|
}>;
|
|
56
56
|
export type CollapsiblePagerViewOnNativeTabPressEvent = ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>;
|
|
57
57
|
export type CollapsiblePagerViewOnNativeSubHeaderPressEvent = ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>;
|
|
58
|
-
export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children" | "headerHeight" | "stickyHeaderHeight" | "
|
|
58
|
+
export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children" | "headerHeight" | "stickyHeaderHeight" | "pageKeys" | "retainedPages" | "nativeTabBarItems" | "nativeTabBarHeight" | "nativeTabBarContentPaddingHorizontal" | "nativeTabBarItemSpacing" | "nativeTabBarFontSize" | "nativeTabBarFontFamily" | "nativeTabBarBackgroundColor" | "nativeTabBarActiveTextColor" | "nativeTabBarInactiveTextColor" | "nativeTabBarIndicatorColor" | "nativeTabBarIndicatorHeight" | "nativeTabBarIndicatorBottom" | "nativeSubHeaderConfig" | "nativeSubHeaderSelectedBackgroundColor" | "onNativeTabPress" | "onNativeSubHeaderPress" | "layoutDirection"> {
|
|
59
59
|
/** Collapsible content rendered above the sticky bar. */
|
|
60
60
|
header: React.ReactNode;
|
|
61
61
|
/** Bar which remains pinned after the header has collapsed. */
|
|
@@ -64,14 +64,6 @@ export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children"
|
|
|
64
64
|
headerHeight: number;
|
|
65
65
|
/** Measured sticky bar height. */
|
|
66
66
|
stickyHeaderHeight: number;
|
|
67
|
-
/** Fixed content above the collapsible header on iOS 26 and newer. */
|
|
68
|
-
topOverlay?: React.ReactNode;
|
|
69
|
-
/** Existing fixed header shared with a parent pager on iOS 26 and newer. */
|
|
70
|
-
externalTopOverlayTag?: number;
|
|
71
|
-
/** Enables UIKit's hard top scroll-edge effect on iOS 26 and newer. */
|
|
72
|
-
topScrollEdgeEffect?: "hard";
|
|
73
|
-
/** Effective appearance of the fixed overlay or pinned sticky bar. */
|
|
74
|
-
topOverlayColorScheme?: "light" | "dark";
|
|
75
67
|
/**
|
|
76
68
|
* Lets the active native list own vertical gestures that begin on pager headers.
|
|
77
69
|
* Defaults to false and has no effect on Web.
|
|
@@ -101,7 +93,6 @@ export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children"
|
|
|
101
93
|
type State = {
|
|
102
94
|
selectedPage: number;
|
|
103
95
|
transientRetainedPages: readonly number[];
|
|
104
|
-
topOverlayHeight: number;
|
|
105
96
|
};
|
|
106
97
|
/**
|
|
107
98
|
* Pager variant whose vertical header coordination is performed by the native
|
|
@@ -39,10 +39,6 @@ export interface CollapsiblePagerViewProps extends Omit<WebCollapsiblePagerNativ
|
|
|
39
39
|
stickyHeader: React.ReactNode;
|
|
40
40
|
headerHeight: number;
|
|
41
41
|
stickyHeaderHeight: number;
|
|
42
|
-
topOverlay?: React.ReactNode;
|
|
43
|
-
topScrollEdgeEffect?: "hard";
|
|
44
|
-
topOverlayColorScheme?: "light" | "dark";
|
|
45
|
-
externalTopOverlayTag?: number;
|
|
46
42
|
pageRetentionDistance?: number;
|
|
47
43
|
layoutDirection?: "ltr" | "rtl" | "locale";
|
|
48
44
|
children?: React.ReactNode;
|
|
@@ -26,9 +26,6 @@ export type OnNativeTabPressEventData = Readonly<{
|
|
|
26
26
|
position: Int32;
|
|
27
27
|
key: string;
|
|
28
28
|
}>;
|
|
29
|
-
export type OnScrollEdgeCapabilityEventData = Readonly<{
|
|
30
|
-
available: boolean;
|
|
31
|
-
}>;
|
|
32
29
|
/**
|
|
33
30
|
* Internal native props. Consumers should use CollapsiblePagerViewProps from
|
|
34
31
|
* CollapsiblePagerView instead of mounting this host component directly.
|
|
@@ -42,10 +39,6 @@ export interface NativeProps extends ViewProps {
|
|
|
42
39
|
nativeSmoothHeaderScrollEnabled?: WithDefault<boolean, false>;
|
|
43
40
|
headerHeight?: Int32;
|
|
44
41
|
stickyHeaderHeight?: Int32;
|
|
45
|
-
topScrollEdgeHard?: WithDefault<boolean, false>;
|
|
46
|
-
topOverlayColorScheme?: string;
|
|
47
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
48
|
-
externalTopOverlayTag?: WithDefault<Int32, 0>;
|
|
49
42
|
pageKeys?: string;
|
|
50
43
|
retainedPages?: string;
|
|
51
44
|
nativeTabBarItems?: string;
|
|
@@ -68,7 +61,6 @@ export interface NativeProps extends ViewProps {
|
|
|
68
61
|
onCollapsibleStateChanged?: DirectEventHandler<OnCollapsibleStateChangedEventData>;
|
|
69
62
|
onNativeTabPress?: DirectEventHandler<OnNativeTabPressEventData>;
|
|
70
63
|
onNativeSubHeaderPress?: DirectEventHandler<OnNativeTabPressEventData>;
|
|
71
|
-
onScrollEdgeCapability?: DirectEventHandler<OnScrollEdgeCapabilityEventData>;
|
|
72
64
|
}
|
|
73
65
|
type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
|
|
74
66
|
export interface NativeCommands {
|
|
@@ -5,10 +5,6 @@ export declare const NATIVE_SCROLLER_NATIVE_ID_PREFIX = "rnc-collapsible-pager-n
|
|
|
5
5
|
/** Supported vertical subset; horizontal, snapping, zoom and sticky rows are not supported. */
|
|
6
6
|
export interface NativeScrollerProps extends ViewProps, Pick<ScrollViewProps, "contentContainerStyle" | "onContentSizeChange" | "scrollEnabled" | "nestedScrollEnabled" | "showsVerticalScrollIndicator" | "showsHorizontalScrollIndicator" | "bounces" | "alwaysBounceVertical" | "contentInset" | "keyboardDismissMode" | "keyboardShouldPersistTaps" | "scrollEventThrottle" | "decelerationRate" | "onScroll" | "onScrollBeginDrag" | "onScrollEndDrag" | "onMomentumScrollBegin" | "onMomentumScrollEnd"> {
|
|
7
7
|
pagerScrollKey?: string;
|
|
8
|
-
/** Fixed overlay above scrolling content on iOS 26 and newer. */
|
|
9
|
-
topOverlay?: React.ReactNode;
|
|
10
|
-
/** Enables UIKit's hard top scroll-edge effect on iOS 26 and newer. */
|
|
11
|
-
topScrollEdgeEffect?: "hard";
|
|
12
8
|
/** iOS only. Android retains AndroidX's native fling physics. */
|
|
13
9
|
decelerationRate?: ScrollViewProps["decelerationRate"];
|
|
14
10
|
/** Standard RefreshControl props are mapped to the independently owned native controller. */
|
|
@@ -47,8 +47,6 @@ export interface NativeProps extends ViewProps {
|
|
|
47
47
|
contentInsetRight?: WithDefault<Double, 0>;
|
|
48
48
|
contentInsetBottom?: WithDefault<Double, 0>;
|
|
49
49
|
contentInsetLeft?: WithDefault<Double, 0>;
|
|
50
|
-
topScrollEdgeHard?: WithDefault<boolean, false>;
|
|
51
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
52
50
|
refreshEnabled?: WithDefault<boolean, false>;
|
|
53
51
|
refreshing?: WithDefault<boolean, false>;
|
|
54
52
|
refreshTintColor?: ColorValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-pager-view",
|
|
3
|
-
"version": "3.0.179-alpha.
|
|
3
|
+
"version": "3.0.179-alpha.302",
|
|
4
4
|
"description": "React Native wrapper for Android and iOS ViewPager",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"typescript": "^5.9.2"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@onekeyfe/react-native-native-logger": "3.0.179-alpha.
|
|
75
|
+
"@onekeyfe/react-native-native-logger": "3.0.179-alpha.302",
|
|
76
76
|
"react": "*",
|
|
77
77
|
"react-native": "*"
|
|
78
78
|
},
|
|
@@ -86,9 +86,6 @@ export interface CollapsiblePagerViewProps
|
|
|
86
86
|
| "children"
|
|
87
87
|
| "headerHeight"
|
|
88
88
|
| "stickyHeaderHeight"
|
|
89
|
-
| "topScrollEdgeHard"
|
|
90
|
-
| "topOverlayHeight"
|
|
91
|
-
| "externalTopOverlayTag"
|
|
92
89
|
| "pageKeys"
|
|
93
90
|
| "retainedPages"
|
|
94
91
|
| "nativeTabBarItems"
|
|
@@ -117,14 +114,6 @@ export interface CollapsiblePagerViewProps
|
|
|
117
114
|
headerHeight: number;
|
|
118
115
|
/** Measured sticky bar height. */
|
|
119
116
|
stickyHeaderHeight: number;
|
|
120
|
-
/** Fixed content above the collapsible header on iOS 26 and newer. */
|
|
121
|
-
topOverlay?: React.ReactNode;
|
|
122
|
-
/** Existing fixed header shared with a parent pager on iOS 26 and newer. */
|
|
123
|
-
externalTopOverlayTag?: number;
|
|
124
|
-
/** Enables UIKit's hard top scroll-edge effect on iOS 26 and newer. */
|
|
125
|
-
topScrollEdgeEffect?: "hard";
|
|
126
|
-
/** Effective appearance of the fixed overlay or pinned sticky bar. */
|
|
127
|
-
topOverlayColorScheme?: "light" | "dark";
|
|
128
117
|
/**
|
|
129
118
|
* Lets the active native list own vertical gestures that begin on pager headers.
|
|
130
119
|
* Defaults to false and has no effect on Web.
|
|
@@ -157,7 +146,6 @@ export interface CollapsiblePagerViewProps
|
|
|
157
146
|
type State = {
|
|
158
147
|
selectedPage: number;
|
|
159
148
|
transientRetainedPages: readonly number[];
|
|
160
|
-
topOverlayHeight: number;
|
|
161
149
|
};
|
|
162
150
|
|
|
163
151
|
const pageIndex = (value: number) => {
|
|
@@ -185,7 +173,6 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
185
173
|
State
|
|
186
174
|
> {
|
|
187
175
|
state: State = {
|
|
188
|
-
topOverlayHeight: 0,
|
|
189
176
|
selectedPage: clampedPageIndex(
|
|
190
177
|
this.props.initialPage ?? 0,
|
|
191
178
|
React.Children.toArray(this.props.children).length
|
|
@@ -471,10 +458,6 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
471
458
|
stickyHeader,
|
|
472
459
|
headerHeight,
|
|
473
460
|
stickyHeaderHeight,
|
|
474
|
-
topOverlay,
|
|
475
|
-
externalTopOverlayTag,
|
|
476
|
-
topScrollEdgeEffect,
|
|
477
|
-
topOverlayColorScheme,
|
|
478
461
|
nativeSmoothHeaderScrollEnabled,
|
|
479
462
|
pageRetentionDistance: _pageRetentionDistance,
|
|
480
463
|
onMountedPagesChanged: _onMountedPagesChanged,
|
|
@@ -491,10 +474,6 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
491
474
|
...nativeProps
|
|
492
475
|
} = this.props;
|
|
493
476
|
const pages = this.pages();
|
|
494
|
-
const supportsTopScrollEdge =
|
|
495
|
-
Platform.OS === "ios" && parseInt(String(Platform.Version), 10) >= 26;
|
|
496
|
-
const hardScrollEdge = supportsTopScrollEdge && topScrollEdgeEffect === "hard";
|
|
497
|
-
const hasTopOverlay = hardScrollEdge && topOverlay != null;
|
|
498
477
|
const pageKeys = pages.map(pageKey);
|
|
499
478
|
const retained = new Set(this.mountedPages(pages.length));
|
|
500
479
|
const deducedLayoutDirection =
|
|
@@ -535,14 +514,6 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
535
514
|
offscreenPageLimit={Math.max(1, offscreenPageLimit ?? 1)}
|
|
536
515
|
headerHeight={Math.max(0, Math.round(headerHeight))}
|
|
537
516
|
stickyHeaderHeight={Math.max(0, Math.round(stickyHeaderHeight))}
|
|
538
|
-
topScrollEdgeHard={hardScrollEdge}
|
|
539
|
-
topOverlayColorScheme={hardScrollEdge ? topOverlayColorScheme : undefined}
|
|
540
|
-
topOverlayHeight={hasTopOverlay ? this.state.topOverlayHeight : 0}
|
|
541
|
-
externalTopOverlayTag={
|
|
542
|
-
supportsTopScrollEdge && !hasTopOverlay
|
|
543
|
-
? externalTopOverlayTag ?? 0
|
|
544
|
-
: 0
|
|
545
|
-
}
|
|
546
517
|
nativeSmoothHeaderScrollEnabled={nativeSmoothHeaderScrollEnabled}
|
|
547
518
|
pageKeys={JSON.stringify(pageKeys)}
|
|
548
519
|
retainedPages={JSON.stringify([...retained])}
|
|
@@ -632,21 +603,6 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
632
603
|
>
|
|
633
604
|
{stickyHeader}
|
|
634
605
|
</View>
|
|
635
|
-
{hasTopOverlay ? (
|
|
636
|
-
<View
|
|
637
|
-
key="top-overlay"
|
|
638
|
-
collapsable={false}
|
|
639
|
-
style={[styles.slot, { bottom: undefined }]}
|
|
640
|
-
onLayout={(event) => {
|
|
641
|
-
const height = Math.ceil(event.nativeEvent.layout.height);
|
|
642
|
-
if (this.state.topOverlayHeight !== height) {
|
|
643
|
-
this.setState({ topOverlayHeight: height });
|
|
644
|
-
}
|
|
645
|
-
}}
|
|
646
|
-
>
|
|
647
|
-
{topOverlay}
|
|
648
|
-
</View>
|
|
649
|
-
) : null}
|
|
650
606
|
{pages.map((page, index) => (
|
|
651
607
|
<View
|
|
652
608
|
key={pageKeys[index]}
|
|
@@ -66,10 +66,6 @@ export interface CollapsiblePagerViewProps
|
|
|
66
66
|
stickyHeader: React.ReactNode;
|
|
67
67
|
headerHeight: number;
|
|
68
68
|
stickyHeaderHeight: number;
|
|
69
|
-
topOverlay?: React.ReactNode;
|
|
70
|
-
topScrollEdgeEffect?: "hard";
|
|
71
|
-
topOverlayColorScheme?: "light" | "dark";
|
|
72
|
-
externalTopOverlayTag?: number;
|
|
73
69
|
pageRetentionDistance?: number;
|
|
74
70
|
layoutDirection?: "ltr" | "rtl" | "locale";
|
|
75
71
|
children?: React.ReactNode;
|
|
@@ -763,10 +759,6 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
763
759
|
children: _children,
|
|
764
760
|
header,
|
|
765
761
|
stickyHeader,
|
|
766
|
-
topOverlay: _topOverlay,
|
|
767
|
-
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
768
|
-
topOverlayColorScheme: _topOverlayColorScheme,
|
|
769
|
-
externalTopOverlayTag: _externalTopOverlayTag,
|
|
770
762
|
headerHeight: _headerHeight,
|
|
771
763
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
772
764
|
pageRetentionDistance: _pageRetentionDistance,
|
|
@@ -43,7 +43,6 @@ export type OnNativeTabPressEventData = Readonly<{
|
|
|
43
43
|
position: Int32;
|
|
44
44
|
key: string;
|
|
45
45
|
}>;
|
|
46
|
-
export type OnScrollEdgeCapabilityEventData = Readonly<{ available: boolean }>;
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
48
|
* Internal native props. Consumers should use CollapsiblePagerViewProps from
|
|
@@ -59,10 +58,6 @@ export interface NativeProps extends ViewProps {
|
|
|
59
58
|
nativeSmoothHeaderScrollEnabled?: WithDefault<boolean, false>;
|
|
60
59
|
headerHeight?: Int32;
|
|
61
60
|
stickyHeaderHeight?: Int32;
|
|
62
|
-
topScrollEdgeHard?: WithDefault<boolean, false>;
|
|
63
|
-
topOverlayColorScheme?: string;
|
|
64
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
65
|
-
externalTopOverlayTag?: WithDefault<Int32, 0>;
|
|
66
61
|
pageKeys?: string;
|
|
67
62
|
retainedPages?: string;
|
|
68
63
|
nativeTabBarItems?: string;
|
|
@@ -85,7 +80,6 @@ export interface NativeProps extends ViewProps {
|
|
|
85
80
|
onCollapsibleStateChanged?: DirectEventHandler<OnCollapsibleStateChangedEventData>;
|
|
86
81
|
onNativeTabPress?: DirectEventHandler<OnNativeTabPressEventData>;
|
|
87
82
|
onNativeSubHeaderPress?: DirectEventHandler<OnNativeTabPressEventData>;
|
|
88
|
-
onScrollEdgeCapability?: DirectEventHandler<OnScrollEdgeCapabilityEventData>;
|
|
89
83
|
}
|
|
90
84
|
|
|
91
85
|
type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
|
package/src/NativeScroller.tsx
CHANGED
|
@@ -44,10 +44,6 @@ export interface NativeScrollerProps
|
|
|
44
44
|
| "onMomentumScrollEnd"
|
|
45
45
|
> {
|
|
46
46
|
pagerScrollKey?: string;
|
|
47
|
-
/** Fixed overlay above scrolling content on iOS 26 and newer. */
|
|
48
|
-
topOverlay?: React.ReactNode;
|
|
49
|
-
/** Enables UIKit's hard top scroll-edge effect on iOS 26 and newer. */
|
|
50
|
-
topScrollEdgeEffect?: "hard";
|
|
51
47
|
/** iOS only. Android retains AndroidX's native fling physics. */
|
|
52
48
|
decelerationRate?: ScrollViewProps["decelerationRate"];
|
|
53
49
|
/** Standard RefreshControl props are mapped to the independently owned native controller. */
|
|
@@ -85,8 +81,6 @@ export const NativeScroller = React.forwardRef<
|
|
|
85
81
|
>(function NativeScroller(
|
|
86
82
|
{
|
|
87
83
|
children,
|
|
88
|
-
topOverlay,
|
|
89
|
-
topScrollEdgeEffect,
|
|
90
84
|
nativeID,
|
|
91
85
|
pagerScrollKey,
|
|
92
86
|
style,
|
|
@@ -115,10 +109,6 @@ export const NativeScroller = React.forwardRef<
|
|
|
115
109
|
const generatedId = React.useId();
|
|
116
110
|
const [contentViewportHeight, setContentViewportHeight] = React.useState(0);
|
|
117
111
|
const [contentSize, setContentSize] = React.useState({ width: 0, height: 0 });
|
|
118
|
-
const [topOverlayHeight, setTopOverlayHeight] = React.useState(0);
|
|
119
|
-
const hasTopOverlay =
|
|
120
|
-
Platform.OS === "ios" && parseInt(String(Platform.Version), 10) >= 26 &&
|
|
121
|
-
topScrollEdgeEffect === "hard" && topOverlay != null;
|
|
122
112
|
const [refreshEpoch, requestRefreshSync] = React.useReducer(
|
|
123
113
|
(value: number) => value + 1,
|
|
124
114
|
0
|
|
@@ -197,14 +187,13 @@ export const NativeScroller = React.forwardRef<
|
|
|
197
187
|
);
|
|
198
188
|
|
|
199
189
|
return (
|
|
200
|
-
<View collapsable={false} style={[styles.viewport, style]} onLayout={onLayout}>
|
|
201
190
|
<NativeScrollerHost
|
|
202
191
|
{...props}
|
|
203
192
|
ref={hostRef}
|
|
204
193
|
nativeID={`${NATIVE_SCROLLER_NATIVE_ID_PREFIX}:${
|
|
205
194
|
pagerScrollKey ?? nativeID ?? generatedId
|
|
206
195
|
}`}
|
|
207
|
-
style={
|
|
196
|
+
style={[styles.viewport, style]}
|
|
208
197
|
nestedScrollEnabled={nestedScrollEnabled}
|
|
209
198
|
contentWidth={contentSize.width}
|
|
210
199
|
contentHeight={contentSize.height}
|
|
@@ -212,8 +201,6 @@ export const NativeScroller = React.forwardRef<
|
|
|
212
201
|
contentInsetRight={contentInset?.right ?? 0}
|
|
213
202
|
contentInsetBottom={contentInset?.bottom ?? 0}
|
|
214
203
|
contentInsetLeft={contentInset?.left ?? 0}
|
|
215
|
-
topScrollEdgeHard={hasTopOverlay}
|
|
216
|
-
topOverlayHeight={hasTopOverlay ? topOverlayHeight : 0}
|
|
217
204
|
decelerationRate={rate}
|
|
218
205
|
keyboardShouldPersistTaps={persistTaps}
|
|
219
206
|
refreshEnabled={Boolean(refresh) && refresh?.enabled !== false}
|
|
@@ -232,6 +219,7 @@ export const NativeScroller = React.forwardRef<
|
|
|
232
219
|
requestRefreshSync();
|
|
233
220
|
}
|
|
234
221
|
}}
|
|
222
|
+
onLayout={onLayout}
|
|
235
223
|
onContentViewportChange={(event) => {
|
|
236
224
|
const height = event.nativeEvent.height;
|
|
237
225
|
if (!Number.isFinite(height) || height < 0) return;
|
|
@@ -318,19 +306,6 @@ export const NativeScroller = React.forwardRef<
|
|
|
318
306
|
{children}
|
|
319
307
|
</View>
|
|
320
308
|
</NativeScrollerHost>
|
|
321
|
-
{hasTopOverlay ? (
|
|
322
|
-
<View
|
|
323
|
-
collapsable={false}
|
|
324
|
-
style={{ position: "absolute", top: 0, left: 0, right: 0 }}
|
|
325
|
-
onLayout={(event) => {
|
|
326
|
-
const height = Math.ceil(event.nativeEvent.layout.height);
|
|
327
|
-
setTopOverlayHeight((previous) => previous === height ? previous : height);
|
|
328
|
-
}}
|
|
329
|
-
>
|
|
330
|
-
{topOverlay}
|
|
331
|
-
</View>
|
|
332
|
-
) : null}
|
|
333
|
-
</View>
|
|
334
309
|
);
|
|
335
310
|
});
|
|
336
311
|
|
|
@@ -14,8 +14,6 @@ export const NativeScroller = React.forwardRef<
|
|
|
14
14
|
const {
|
|
15
15
|
dataSet,
|
|
16
16
|
pagerScrollKey: _pagerScrollKey,
|
|
17
|
-
topOverlay: _topOverlay,
|
|
18
|
-
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
19
17
|
...props
|
|
20
18
|
} = inputProps as NativeScrollerWebProps;
|
|
21
19
|
const webDataProps = {
|
|
@@ -47,8 +47,6 @@ export interface NativeProps extends ViewProps {
|
|
|
47
47
|
contentInsetRight?: WithDefault<Double, 0>;
|
|
48
48
|
contentInsetBottom?: WithDefault<Double, 0>;
|
|
49
49
|
contentInsetLeft?: WithDefault<Double, 0>;
|
|
50
|
-
topScrollEdgeHard?: WithDefault<boolean, false>;
|
|
51
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
52
50
|
refreshEnabled?: WithDefault<boolean, false>;
|
|
53
51
|
refreshing?: WithDefault<boolean, false>;
|
|
54
52
|
refreshTintColor?: ColorValue;
|