@onekeyfe/react-native-pager-view 6.7.0-20 → 6.7.0-22
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/CollapsiblePagerHost.kt +40 -9
- package/android/src/main/java/com/reactnativepagerview/NestedScrollableHost.kt +8 -2
- package/docs/SPEC.md +44 -0
- package/ios/RNCCollapsiblePagerViewComponentView.mm +410 -19
- package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +36 -5
- 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/module/WebCollapsiblePagerPage.js +7 -2
- 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 +19 -7
- 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
- package/src/WebCollapsiblePagerPage.tsx +7 -2
|
@@ -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>,
|
|
@@ -221,7 +221,12 @@ export function WebCollapsiblePagerPage({
|
|
|
221
221
|
owner.addEventListener("keydown", handleKey);
|
|
222
222
|
owner.addEventListener("ok-collapsible-pager-user-scroll", handleUserInput);
|
|
223
223
|
owner.addEventListener("ok-collapsible-pager-insets-changed", requestMeasure);
|
|
224
|
-
|
|
224
|
+
// Measure synchronously while still inside the layout phase: the metrics
|
|
225
|
+
// start at width 0, and deferring this first measurement to the next
|
|
226
|
+
// animation frame let the page paint once at width 0, which collapsed
|
|
227
|
+
// shrinkable page content (a fiat hero wrapped one character per line,
|
|
228
|
+
// OK-66299). Resize and scroll updates stay frame-coalesced.
|
|
229
|
+
measure();
|
|
225
230
|
return () => {
|
|
226
231
|
observer.disconnect();
|
|
227
232
|
observerRef.current = null;
|
|
@@ -235,7 +240,7 @@ export function WebCollapsiblePagerPage({
|
|
|
235
240
|
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
236
241
|
frameRef.current = null;
|
|
237
242
|
};
|
|
238
|
-
}, [owner, requestMeasure, syncContentObservation]);
|
|
243
|
+
}, [owner, measure, requestMeasure, syncContentObservation]);
|
|
239
244
|
|
|
240
245
|
React.useLayoutEffect(requestMeasure, [isFocused, isRouteActive, headerHeight, stickyHeaderHeight, requestMeasure]);
|
|
241
246
|
|