@onekeyfe/react-native-pager-view 6.7.0-alpha.430 → 6.7.0-alpha.435
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/docs/SPEC.md +40 -0
- package/ios/RNCCollapsiblePagerViewComponentView.mm +410 -19
- package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +756 -0
- package/lib/module/CollapsiblePagerViewNativeComponent.ts +41 -46
- package/lib/module/NativeScroller.web.js +3 -0
- package/lib/module/NativeScrollerNativeComponent.ts +43 -46
- package/lib/module/PagerViewNativeComponent.ts +20 -25
- package/lib/typescript/src/CollapsiblePagerView.d.ts +1 -1
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +1 -1
- package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +41 -42
- 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 +5 -5
- package/src/CollapsiblePagerViewNativeComponent.ts +41 -46
- package/src/NativeScroller.tsx +14 -3
- package/src/NativeScroller.web.tsx +15 -1
- package/src/NativeScrollerNativeComponent.ts +43 -46
- package/src/PagerViewNativeComponent.ts +20 -25
|
@@ -1,76 +1,75 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
|
-
import { type ColorValue, type HostComponent, type ViewProps } from "react-native";
|
|
3
|
-
import type { DirectEventHandler, Double, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
2
|
+
import { type CodegenTypes, type ColorValue, type HostComponent, type ViewProps } from "react-native";
|
|
4
3
|
export type NativeScrollerScrollEvent = Readonly<{
|
|
5
4
|
contentInset: Readonly<{
|
|
6
|
-
top: Double;
|
|
7
|
-
right: Double;
|
|
8
|
-
bottom: Double;
|
|
9
|
-
left: Double;
|
|
5
|
+
top: CodegenTypes.Double;
|
|
6
|
+
right: CodegenTypes.Double;
|
|
7
|
+
bottom: CodegenTypes.Double;
|
|
8
|
+
left: CodegenTypes.Double;
|
|
10
9
|
}>;
|
|
11
10
|
contentOffset: Readonly<{
|
|
12
|
-
x: Double;
|
|
13
|
-
y: Double;
|
|
11
|
+
x: CodegenTypes.Double;
|
|
12
|
+
y: CodegenTypes.Double;
|
|
14
13
|
}>;
|
|
15
14
|
contentSize: Readonly<{
|
|
16
|
-
width: Double;
|
|
17
|
-
height: Double;
|
|
15
|
+
width: CodegenTypes.Double;
|
|
16
|
+
height: CodegenTypes.Double;
|
|
18
17
|
}>;
|
|
19
18
|
layoutMeasurement: Readonly<{
|
|
20
|
-
width: Double;
|
|
21
|
-
height: Double;
|
|
19
|
+
width: CodegenTypes.Double;
|
|
20
|
+
height: CodegenTypes.Double;
|
|
22
21
|
}>;
|
|
23
22
|
velocity: Readonly<{
|
|
24
|
-
x: Double;
|
|
25
|
-
y: Double;
|
|
23
|
+
x: CodegenTypes.Double;
|
|
24
|
+
y: CodegenTypes.Double;
|
|
26
25
|
}>;
|
|
27
26
|
targetContentOffset: Readonly<{
|
|
28
|
-
x: Double;
|
|
29
|
-
y: Double;
|
|
27
|
+
x: CodegenTypes.Double;
|
|
28
|
+
y: CodegenTypes.Double;
|
|
30
29
|
}>;
|
|
31
|
-
zoomScale: Double;
|
|
30
|
+
zoomScale: CodegenTypes.Double;
|
|
32
31
|
}>;
|
|
33
32
|
export interface NativeProps extends ViewProps {
|
|
34
|
-
contentWidth?: WithDefault<Double, 0>;
|
|
35
|
-
contentHeight?: WithDefault<Double, 0>;
|
|
36
|
-
scrollEnabled?: WithDefault<boolean, true>;
|
|
37
|
-
nestedScrollEnabled?: WithDefault<boolean, true>;
|
|
38
|
-
showsVerticalScrollIndicator?: WithDefault<boolean, true>;
|
|
39
|
-
showsHorizontalScrollIndicator?: WithDefault<boolean, false>;
|
|
40
|
-
bounces?: WithDefault<boolean, true>;
|
|
41
|
-
alwaysBounceVertical?: WithDefault<boolean, true>;
|
|
42
|
-
keyboardDismissMode?: WithDefault<"none" | "on-drag" | "interactive", "none">;
|
|
43
|
-
keyboardShouldPersistTaps?: WithDefault<"never" | "always" | "handled", "never">;
|
|
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>;
|
|
33
|
+
contentWidth?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
34
|
+
contentHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
35
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
36
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
37
|
+
showsVerticalScrollIndicator?: CodegenTypes.WithDefault<boolean, true>;
|
|
38
|
+
showsHorizontalScrollIndicator?: CodegenTypes.WithDefault<boolean, false>;
|
|
39
|
+
bounces?: CodegenTypes.WithDefault<boolean, true>;
|
|
40
|
+
alwaysBounceVertical?: CodegenTypes.WithDefault<boolean, true>;
|
|
41
|
+
keyboardDismissMode?: CodegenTypes.WithDefault<"none" | "on-drag" | "interactive", "none">;
|
|
42
|
+
keyboardShouldPersistTaps?: CodegenTypes.WithDefault<"never" | "always" | "handled", "never">;
|
|
43
|
+
scrollEventThrottle?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
44
|
+
decelerationRate?: CodegenTypes.WithDefault<CodegenTypes.Double, 0.998>;
|
|
45
|
+
contentInsetTop?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
46
|
+
contentInsetRight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
47
|
+
contentInsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
48
|
+
contentInsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
49
|
+
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
50
|
+
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
51
|
+
refreshEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
52
|
+
refreshing?: CodegenTypes.WithDefault<boolean, false>;
|
|
54
53
|
refreshTintColor?: ColorValue;
|
|
55
54
|
refreshColors?: ReadonlyArray<ColorValue>;
|
|
56
55
|
refreshProgressBackgroundColor?: ColorValue;
|
|
57
|
-
refreshProgressViewOffset?: WithDefault<Double, 0>;
|
|
56
|
+
refreshProgressViewOffset?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
58
57
|
refreshTitle?: string;
|
|
59
58
|
refreshTitleColor?: ColorValue;
|
|
60
|
-
refreshSize?: WithDefault<"default" | "large", "default">;
|
|
61
|
-
onContentViewportChange?: DirectEventHandler<Readonly<{
|
|
62
|
-
height: Double;
|
|
59
|
+
refreshSize?: CodegenTypes.WithDefault<"default" | "large", "default">;
|
|
60
|
+
onContentViewportChange?: CodegenTypes.DirectEventHandler<Readonly<{
|
|
61
|
+
height: CodegenTypes.Double;
|
|
63
62
|
}>>;
|
|
64
|
-
onRefresh?: DirectEventHandler<null>;
|
|
65
|
-
onScroll?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
66
|
-
onScrollBeginDrag?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
67
|
-
onScrollEndDrag?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
68
|
-
onMomentumScrollBegin?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
69
|
-
onMomentumScrollEnd?: DirectEventHandler<NativeScrollerScrollEvent>;
|
|
63
|
+
onRefresh?: CodegenTypes.DirectEventHandler<null>;
|
|
64
|
+
onScroll?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
65
|
+
onScrollBeginDrag?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
66
|
+
onScrollEndDrag?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
67
|
+
onMomentumScrollBegin?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
68
|
+
onMomentumScrollEnd?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
70
69
|
}
|
|
71
70
|
type NativeScrollerHost = HostComponent<NativeProps>;
|
|
72
71
|
export interface NativeCommands {
|
|
73
|
-
scrollTo: (viewRef: React.ElementRef<NativeScrollerHost>, x: Double, y: Double, animated: boolean) => void;
|
|
72
|
+
scrollTo: (viewRef: React.ElementRef<NativeScrollerHost>, x: CodegenTypes.Double, y: CodegenTypes.Double, animated: boolean) => void;
|
|
74
73
|
scrollToEnd: (viewRef: React.ElementRef<NativeScrollerHost>, animated: boolean) => void;
|
|
75
74
|
flashScrollIndicators: (viewRef: React.ElementRef<NativeScrollerHost>) => void;
|
|
76
75
|
setRefreshState: (viewRef: React.ElementRef<NativeScrollerHost>, refreshing: boolean) => void;
|
|
@@ -65,6 +65,6 @@ export declare class PagerView extends React.Component<NativeProps> {
|
|
|
65
65
|
* imperative solution is more useful (e.g. for not blocking an animation)
|
|
66
66
|
*/
|
|
67
67
|
setScrollEnabled: (scrollEnabled: boolean) => void;
|
|
68
|
-
render():
|
|
68
|
+
render(): React.JSX.Element;
|
|
69
69
|
}
|
|
70
70
|
//# sourceMappingURL=PagerView.d.ts.map
|
|
@@ -47,7 +47,7 @@ export declare class PagerView extends React.Component<PagerViewProps, State> {
|
|
|
47
47
|
private selectPage;
|
|
48
48
|
private onTouchStart;
|
|
49
49
|
private onTouchEnd;
|
|
50
|
-
render():
|
|
50
|
+
render(): React.JSX.Element;
|
|
51
51
|
}
|
|
52
52
|
export type PagerViewOnPageScrollEvent = ReactNative.NativeSyntheticEvent<PagerViewOnPageScrollEventData>;
|
|
53
53
|
export type PagerViewOnPageSelectedEvent = ReactNative.NativeSyntheticEvent<PagerViewOnPageSelectedEventData>;
|
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import { type HostComponent, type ViewProps } from 'react-native';
|
|
3
|
-
import type { DirectEventHandler, Double, Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
2
|
+
import { type CodegenTypes, type HostComponent, type ViewProps } from 'react-native';
|
|
4
3
|
export type OnPageScrollEventData = Readonly<{
|
|
5
|
-
position: Double;
|
|
6
|
-
offset: Double;
|
|
4
|
+
position: CodegenTypes.Double;
|
|
5
|
+
offset: CodegenTypes.Double;
|
|
7
6
|
}>;
|
|
8
7
|
export type OnPageSelectedEventData = Readonly<{
|
|
9
|
-
position: Double;
|
|
8
|
+
position: CodegenTypes.Double;
|
|
10
9
|
}>;
|
|
11
10
|
export type OnPageScrollStateChangedEventData = Readonly<{
|
|
12
11
|
pageScrollState: 'idle' | 'dragging' | 'settling';
|
|
13
12
|
}>;
|
|
14
13
|
export interface NativeProps extends ViewProps {
|
|
15
|
-
scrollEnabled?: WithDefault<boolean, true>;
|
|
16
|
-
layoutDirection?: WithDefault<'ltr' | 'rtl', 'ltr'>;
|
|
17
|
-
initialPage?: Int32;
|
|
18
|
-
orientation?: WithDefault<'horizontal' | 'vertical', 'horizontal'>;
|
|
19
|
-
offscreenPageLimit?: Int32;
|
|
20
|
-
pageMargin?: Int32;
|
|
21
|
-
overScrollMode?: WithDefault<'auto' | 'always' | 'never', 'auto'>;
|
|
22
|
-
overdrag?: WithDefault<boolean, false>;
|
|
23
|
-
keyboardDismissMode?: WithDefault<'none' | 'on-drag', 'none'>;
|
|
14
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
15
|
+
layoutDirection?: CodegenTypes.WithDefault<'ltr' | 'rtl', 'ltr'>;
|
|
16
|
+
initialPage?: CodegenTypes.Int32;
|
|
17
|
+
orientation?: CodegenTypes.WithDefault<'horizontal' | 'vertical', 'horizontal'>;
|
|
18
|
+
offscreenPageLimit?: CodegenTypes.Int32;
|
|
19
|
+
pageMargin?: CodegenTypes.Int32;
|
|
20
|
+
overScrollMode?: CodegenTypes.WithDefault<'auto' | 'always' | 'never', 'auto'>;
|
|
21
|
+
overdrag?: CodegenTypes.WithDefault<boolean, false>;
|
|
22
|
+
keyboardDismissMode?: CodegenTypes.WithDefault<'none' | 'on-drag', 'none'>;
|
|
24
23
|
/**
|
|
25
24
|
* Controls the sensitivity of scroll gestures on Android.
|
|
26
25
|
* Higher values make scrolling less sensitive.
|
|
27
26
|
* Valid range: 2 - 8
|
|
28
27
|
* @platform android
|
|
29
28
|
*/
|
|
30
|
-
scrollSensitivity?: Int32;
|
|
29
|
+
scrollSensitivity?: CodegenTypes.Int32;
|
|
31
30
|
/**
|
|
32
31
|
* When true on an inner PagerView, enables gesture coordination with
|
|
33
32
|
* a parent (outer) PagerView. At sub-tab boundaries the inner pager's
|
|
34
33
|
* gesture recognizer will not begin, allowing the outer pager to take over.
|
|
35
34
|
* @platform ios
|
|
36
35
|
*/
|
|
37
|
-
nestedScrollEnabled?: WithDefault<boolean, false>;
|
|
38
|
-
onPageScroll?: DirectEventHandler<OnPageScrollEventData>;
|
|
39
|
-
onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
|
|
40
|
-
onPageScrollStateChanged?: DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
36
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
37
|
+
onPageScroll?: CodegenTypes.DirectEventHandler<OnPageScrollEventData>;
|
|
38
|
+
onPageSelected?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
|
|
39
|
+
onPageScrollStateChanged?: CodegenTypes.DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
41
40
|
}
|
|
42
41
|
type PagerViewViewType = HostComponent<NativeProps>;
|
|
43
42
|
export interface NativeCommands {
|
|
44
|
-
setPage: (viewRef: React.ElementRef<PagerViewViewType>, selectedPage: Int32) => void;
|
|
45
|
-
setPageWithoutAnimation: (viewRef: React.ElementRef<PagerViewViewType>, selectedPage: Int32) => void;
|
|
43
|
+
setPage: (viewRef: React.ElementRef<PagerViewViewType>, selectedPage: CodegenTypes.Int32) => void;
|
|
44
|
+
setPageWithoutAnimation: (viewRef: React.ElementRef<PagerViewViewType>, selectedPage: CodegenTypes.Int32) => void;
|
|
46
45
|
setScrollEnabledImperatively: (viewRef: React.ElementRef<PagerViewViewType>, scrollEnabled: boolean) => void;
|
|
47
46
|
}
|
|
48
47
|
export declare const Commands: NativeCommands;
|
|
@@ -38,5 +38,5 @@ export declare function WebCollapsiblePagerPage({ children, pageKey, isFocused,
|
|
|
38
38
|
onGeometryChange: (key: string) => void;
|
|
39
39
|
onScroll: (key: string, top: number) => void;
|
|
40
40
|
onUserInput: (key: string) => void;
|
|
41
|
-
}>):
|
|
41
|
+
}>): React.JSX.Element;
|
|
42
42
|
//# sourceMappingURL=WebCollapsiblePagerPage.d.ts.map
|
|
@@ -27,8 +27,8 @@ export declare function usePagerView({ pagesAmount }?: UsePagerViewParams): {
|
|
|
27
27
|
position: number;
|
|
28
28
|
offset: number;
|
|
29
29
|
}>>;
|
|
30
|
-
onPageScroll: any;
|
|
31
|
-
onPageSelected: any;
|
|
30
|
+
onPageScroll: (...args: Array<any>) => void;
|
|
31
|
+
onPageSelected: (...args: Array<any>) => void;
|
|
32
32
|
onPageScrollStateChanged: (e: PageScrollStateChangedNativeEvent) => void;
|
|
33
33
|
toggleOverdrag: () => void;
|
|
34
34
|
AnimatedPagerView: ReactNative.Animated.AnimatedComponent<Readonly<import("./PagerViewNativeComponent").NativeProps>, PagerView>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export declare const childrenWithOverriddenStyle: (children?: ReactNode) =>
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export declare const childrenWithOverriddenStyle: (children?: ReactNode) => React.JSX.Element[] | null | undefined;
|
|
3
3
|
//# sourceMappingURL=utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-pager-view",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.435",
|
|
4
4
|
"description": "React Native wrapper for Android and iOS ViewPager",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -67,14 +67,14 @@
|
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@types/react": "^19.
|
|
71
|
-
"react": "19.
|
|
72
|
-
"react-native": "patch:react-native@npm%3A0.
|
|
70
|
+
"@types/react": "^19.3.0",
|
|
71
|
+
"react": "19.3.0",
|
|
72
|
+
"react-native": "patch:react-native@npm%3A0.88.0#~/.yarn/patches/react-native-npm-0.88.0-60c6201dd2.patch",
|
|
73
73
|
"react-native-builder-bob": "^0.40.13",
|
|
74
74
|
"typescript": "^5.9.2"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@onekeyfe/react-native-native-logger": "6.7.0-alpha.
|
|
77
|
+
"@onekeyfe/react-native-native-logger": "6.7.0-alpha.435",
|
|
78
78
|
"react": "*",
|
|
79
79
|
"react-native": "*"
|
|
80
80
|
},
|
|
@@ -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,7 +35,7 @@ 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
|
}>;
|
|
46
41
|
export type OnScrollEdgeCapabilityEventData = Readonly<{ available: boolean }>;
|
|
@@ -50,45 +45,45 @@ export type OnScrollEdgeCapabilityEventData = Readonly<{ available: boolean }>;
|
|
|
50
45
|
* CollapsiblePagerView instead of mounting this host component directly.
|
|
51
46
|
*/
|
|
52
47
|
export interface NativeProps extends ViewProps {
|
|
53
|
-
scrollEnabled?: WithDefault<boolean, true>;
|
|
54
|
-
layoutDirection?: WithDefault<"ltr" | "rtl", "ltr">;
|
|
55
|
-
initialPage?: Int32;
|
|
56
|
-
offscreenPageLimit?: Int32;
|
|
48
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
49
|
+
layoutDirection?: CodegenTypes.WithDefault<"ltr" | "rtl", "ltr">;
|
|
50
|
+
initialPage?: CodegenTypes.Int32;
|
|
51
|
+
offscreenPageLimit?: CodegenTypes.Int32;
|
|
57
52
|
// 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
|
-
topScrollEdgeEffect?: WithDefault<"none" | "hard" | "soft", "none">;
|
|
53
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
54
|
+
nativeSmoothHeaderScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
55
|
+
headerHeight?: CodegenTypes.Int32;
|
|
56
|
+
stickyHeaderHeight?: CodegenTypes.Int32;
|
|
57
|
+
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
63
58
|
topOverlayColorScheme?: string;
|
|
64
|
-
topOverlayHeight?: WithDefault<Double, 0>;
|
|
65
|
-
externalTopOverlayTag?: WithDefault<Int32, 0>;
|
|
59
|
+
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
60
|
+
externalTopOverlayTag?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
66
61
|
pageKeys?: string;
|
|
67
62
|
retainedPages?: string;
|
|
68
63
|
nativeTabBarItems?: string;
|
|
69
|
-
nativeTabBarHeight?: Double;
|
|
64
|
+
nativeTabBarHeight?: CodegenTypes.Double;
|
|
70
65
|
nativeTabBarVariant?: string;
|
|
71
|
-
nativeTabBarTrailingReservedWidth?: WithDefault<Double, 0>;
|
|
72
|
-
nativeTabBarContentPaddingHorizontal?: Double;
|
|
73
|
-
nativeTabBarContentPaddingVertical?: Double;
|
|
74
|
-
nativeTabBarItemSpacing?: Double;
|
|
75
|
-
nativeTabBarFontSize?: Double;
|
|
66
|
+
nativeTabBarTrailingReservedWidth?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
67
|
+
nativeTabBarContentPaddingHorizontal?: CodegenTypes.Double;
|
|
68
|
+
nativeTabBarContentPaddingVertical?: CodegenTypes.Double;
|
|
69
|
+
nativeTabBarItemSpacing?: CodegenTypes.Double;
|
|
70
|
+
nativeTabBarFontSize?: CodegenTypes.Double;
|
|
76
71
|
nativeTabBarFontFamily?: string;
|
|
77
72
|
nativeTabBarBackgroundColor?: ColorValue;
|
|
78
73
|
nativeTabBarActiveTextColor?: ColorValue;
|
|
79
74
|
nativeTabBarInactiveTextColor?: ColorValue;
|
|
80
75
|
nativeTabBarIndicatorColor?: ColorValue;
|
|
81
|
-
nativeTabBarIndicatorHeight?: Double;
|
|
82
|
-
nativeTabBarIndicatorBottom?: Double;
|
|
76
|
+
nativeTabBarIndicatorHeight?: CodegenTypes.Double;
|
|
77
|
+
nativeTabBarIndicatorBottom?: CodegenTypes.Double;
|
|
83
78
|
nativeSubHeaderConfig?: string;
|
|
84
79
|
nativeSubHeaderSelectedBackgroundColor?: ColorValue;
|
|
85
|
-
onPageScroll?: DirectEventHandler<OnPageScrollEventData>;
|
|
86
|
-
onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
|
|
87
|
-
onPageScrollStateChanged?: DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
88
|
-
onCollapsibleStateChanged?: DirectEventHandler<OnCollapsibleStateChangedEventData>;
|
|
89
|
-
onNativeTabPress?: DirectEventHandler<OnNativeTabPressEventData>;
|
|
90
|
-
onNativeSubHeaderPress?: DirectEventHandler<OnNativeTabPressEventData>;
|
|
91
|
-
onScrollEdgeCapability?: DirectEventHandler<OnScrollEdgeCapabilityEventData>;
|
|
80
|
+
onPageScroll?: CodegenTypes.DirectEventHandler<OnPageScrollEventData>;
|
|
81
|
+
onPageSelected?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
|
|
82
|
+
onPageScrollStateChanged?: CodegenTypes.DirectEventHandler<OnPageScrollStateChangedEventData>;
|
|
83
|
+
onCollapsibleStateChanged?: CodegenTypes.DirectEventHandler<OnCollapsibleStateChangedEventData>;
|
|
84
|
+
onNativeTabPress?: CodegenTypes.DirectEventHandler<OnNativeTabPressEventData>;
|
|
85
|
+
onNativeSubHeaderPress?: CodegenTypes.DirectEventHandler<OnNativeTabPressEventData>;
|
|
86
|
+
onScrollEdgeCapability?: CodegenTypes.DirectEventHandler<OnScrollEdgeCapabilityEventData>;
|
|
92
87
|
}
|
|
93
88
|
|
|
94
89
|
type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
|
|
@@ -96,24 +91,24 @@ type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
|
|
|
96
91
|
export interface NativeCommands {
|
|
97
92
|
scrollHeaderToOffset: (
|
|
98
93
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
99
|
-
offset: Double
|
|
94
|
+
offset: CodegenTypes.Double
|
|
100
95
|
) => void;
|
|
101
96
|
scrollHeaderBy: (
|
|
102
97
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
103
|
-
delta: Double
|
|
98
|
+
delta: CodegenTypes.Double
|
|
104
99
|
) => void;
|
|
105
100
|
scrollToTop: (
|
|
106
101
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
107
|
-
target: Int32,
|
|
102
|
+
target: CodegenTypes.Int32,
|
|
108
103
|
animated: boolean
|
|
109
104
|
) => void;
|
|
110
105
|
setPage: (
|
|
111
106
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
112
|
-
selectedPage: Int32
|
|
107
|
+
selectedPage: CodegenTypes.Int32
|
|
113
108
|
) => void;
|
|
114
109
|
setPageWithoutAnimation: (
|
|
115
110
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
|
116
|
-
selectedPage: Int32
|
|
111
|
+
selectedPage: CodegenTypes.Int32
|
|
117
112
|
) => void;
|
|
118
113
|
setScrollEnabledImperatively: (
|
|
119
114
|
viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
|
package/src/NativeScroller.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TextInput,
|
|
8
8
|
View,
|
|
9
9
|
type GestureResponderEvent,
|
|
10
|
-
type
|
|
10
|
+
type HostInstance,
|
|
11
11
|
type RefreshControlProps,
|
|
12
12
|
type ScrollView,
|
|
13
13
|
type ScrollViewProps,
|
|
@@ -35,7 +35,6 @@ export interface NativeScrollerProps
|
|
|
35
35
|
| "alwaysBounceVertical"
|
|
36
36
|
| "contentInset"
|
|
37
37
|
| "keyboardDismissMode"
|
|
38
|
-
| "keyboardShouldPersistTaps"
|
|
39
38
|
| "scrollEventThrottle"
|
|
40
39
|
| "decelerationRate"
|
|
41
40
|
| "onScroll"
|
|
@@ -53,12 +52,24 @@ export interface NativeScrollerProps
|
|
|
53
52
|
decelerationRate?: ScrollViewProps["decelerationRate"];
|
|
54
53
|
/** Standard RefreshControl props are mapped to the independently owned native controller. */
|
|
55
54
|
refreshControl?: React.ReactElement<RefreshControlProps>;
|
|
55
|
+
/** Boolean values are deprecated compatibility aliases (`true` -> `always`, `false` -> `never`). */
|
|
56
|
+
keyboardShouldPersistTaps?:
|
|
57
|
+
| ScrollViewProps["keyboardShouldPersistTaps"]
|
|
58
|
+
| boolean;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
type HostRef = React.ElementRef<typeof NativeScrollerHost>;
|
|
59
62
|
|
|
60
63
|
export interface NativeScrollerRef
|
|
61
|
-
extends
|
|
64
|
+
extends Pick<
|
|
65
|
+
HostInstance,
|
|
66
|
+
| "measure"
|
|
67
|
+
| "measureInWindow"
|
|
68
|
+
| "measureLayout"
|
|
69
|
+
| "setNativeProps"
|
|
70
|
+
| "focus"
|
|
71
|
+
| "blur"
|
|
72
|
+
>,
|
|
62
73
|
Pick<
|
|
63
74
|
React.ElementRef<typeof ScrollView>,
|
|
64
75
|
"scrollTo" | "scrollToEnd" | "flashScrollIndicators"
|
|
@@ -16,8 +16,15 @@ export const NativeScroller = React.forwardRef<
|
|
|
16
16
|
pagerScrollKey,
|
|
17
17
|
topOverlay: _topOverlay,
|
|
18
18
|
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
19
|
+
keyboardShouldPersistTaps,
|
|
19
20
|
...props
|
|
20
21
|
} = inputProps as NativeScrollerWebProps;
|
|
22
|
+
const persistTaps =
|
|
23
|
+
keyboardShouldPersistTaps === true
|
|
24
|
+
? "always"
|
|
25
|
+
: keyboardShouldPersistTaps === false
|
|
26
|
+
? "never"
|
|
27
|
+
: keyboardShouldPersistTaps;
|
|
21
28
|
const scrollRef = React.useRef<React.ElementRef<typeof ScrollView>>(null);
|
|
22
29
|
const setRef = React.useCallback(
|
|
23
30
|
(node: React.ElementRef<typeof ScrollView> | null) => {
|
|
@@ -47,7 +54,14 @@ export const NativeScroller = React.forwardRef<
|
|
|
47
54
|
},
|
|
48
55
|
};
|
|
49
56
|
|
|
50
|
-
return
|
|
57
|
+
return (
|
|
58
|
+
<ScrollView
|
|
59
|
+
{...props}
|
|
60
|
+
keyboardShouldPersistTaps={persistTaps}
|
|
61
|
+
ref={setRef}
|
|
62
|
+
{...webDataProps}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
51
65
|
});
|
|
52
66
|
|
|
53
67
|
NativeScroller.displayName = "NativeScroller";
|
|
@@ -2,69 +2,66 @@ 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
|
-
DirectEventHandler,
|
|
11
|
-
Double,
|
|
12
|
-
WithDefault,
|
|
13
|
-
} from "react-native/Libraries/Types/CodegenTypes";
|
|
10
|
+
|
|
14
11
|
|
|
15
12
|
export type NativeScrollerScrollEvent = Readonly<{
|
|
16
13
|
contentInset: Readonly<{
|
|
17
|
-
top: Double;
|
|
18
|
-
right: Double;
|
|
19
|
-
bottom: Double;
|
|
20
|
-
left: Double;
|
|
14
|
+
top: CodegenTypes.Double;
|
|
15
|
+
right: CodegenTypes.Double;
|
|
16
|
+
bottom: CodegenTypes.Double;
|
|
17
|
+
left: CodegenTypes.Double;
|
|
21
18
|
}>;
|
|
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;
|
|
19
|
+
contentOffset: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double }>;
|
|
20
|
+
contentSize: Readonly<{ width: CodegenTypes.Double; height: CodegenTypes.Double }>;
|
|
21
|
+
layoutMeasurement: Readonly<{ width: CodegenTypes.Double; height: CodegenTypes.Double }>;
|
|
22
|
+
velocity: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double }>;
|
|
23
|
+
targetContentOffset: Readonly<{ x: CodegenTypes.Double; y: CodegenTypes.Double }>;
|
|
24
|
+
zoomScale: CodegenTypes.Double;
|
|
28
25
|
}>;
|
|
29
26
|
|
|
30
27
|
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<
|
|
28
|
+
contentWidth?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
29
|
+
contentHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
30
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
31
|
+
nestedScrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
32
|
+
showsVerticalScrollIndicator?: CodegenTypes.WithDefault<boolean, true>;
|
|
33
|
+
showsHorizontalScrollIndicator?: CodegenTypes.WithDefault<boolean, false>;
|
|
34
|
+
bounces?: CodegenTypes.WithDefault<boolean, true>;
|
|
35
|
+
alwaysBounceVertical?: CodegenTypes.WithDefault<boolean, true>;
|
|
36
|
+
keyboardDismissMode?: CodegenTypes.WithDefault<"none" | "on-drag" | "interactive", "none">;
|
|
37
|
+
keyboardShouldPersistTaps?: CodegenTypes.WithDefault<
|
|
41
38
|
"never" | "always" | "handled",
|
|
42
39
|
"never"
|
|
43
40
|
>;
|
|
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>;
|
|
41
|
+
scrollEventThrottle?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
42
|
+
decelerationRate?: CodegenTypes.WithDefault<CodegenTypes.Double, 0.998>;
|
|
43
|
+
contentInsetTop?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
44
|
+
contentInsetRight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
45
|
+
contentInsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
46
|
+
contentInsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
47
|
+
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
48
|
+
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
49
|
+
refreshEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
50
|
+
refreshing?: CodegenTypes.WithDefault<boolean, false>;
|
|
54
51
|
refreshTintColor?: ColorValue;
|
|
55
52
|
refreshColors?: ReadonlyArray<ColorValue>;
|
|
56
53
|
refreshProgressBackgroundColor?: ColorValue;
|
|
57
|
-
refreshProgressViewOffset?: WithDefault<Double, 0>;
|
|
54
|
+
refreshProgressViewOffset?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
58
55
|
refreshTitle?: string;
|
|
59
56
|
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>;
|
|
57
|
+
refreshSize?: CodegenTypes.WithDefault<"default" | "large", "default">;
|
|
58
|
+
onContentViewportChange?: CodegenTypes.DirectEventHandler<Readonly<{ height: CodegenTypes.Double }>>;
|
|
59
|
+
onRefresh?: CodegenTypes.DirectEventHandler<null>;
|
|
60
|
+
onScroll?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
61
|
+
onScrollBeginDrag?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
62
|
+
onScrollEndDrag?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
63
|
+
onMomentumScrollBegin?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
64
|
+
onMomentumScrollEnd?: CodegenTypes.DirectEventHandler<NativeScrollerScrollEvent>;
|
|
68
65
|
}
|
|
69
66
|
|
|
70
67
|
type NativeScrollerHost = HostComponent<NativeProps>;
|
|
@@ -72,8 +69,8 @@ type NativeScrollerHost = HostComponent<NativeProps>;
|
|
|
72
69
|
export interface NativeCommands {
|
|
73
70
|
scrollTo: (
|
|
74
71
|
viewRef: React.ElementRef<NativeScrollerHost>,
|
|
75
|
-
x: Double,
|
|
76
|
-
y: Double,
|
|
72
|
+
x: CodegenTypes.Double,
|
|
73
|
+
y: CodegenTypes.Double,
|
|
77
74
|
animated: boolean
|
|
78
75
|
) => void;
|
|
79
76
|
scrollToEnd: (
|