@onekeyfe/react-native-pager-view 6.7.0-6 → 6.7.0-60

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.
Files changed (49) hide show
  1. package/README.md +159 -115
  2. package/android/build.gradle +1 -0
  3. package/android/src/androidTest/AndroidManifest.xml +7 -0
  4. package/android/src/androidTest/java/com/reactnativepagerview/CollapsiblePagerTabReservationTest.kt +476 -0
  5. package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerHost.kt +233 -43
  6. package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerNativeHeaders.kt +596 -27
  7. package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +40 -0
  8. package/android/src/main/java/com/reactnativepagerview/NativeScrollerScrollAwayInsets.kt +19 -0
  9. package/android/src/main/java/com/reactnativepagerview/NativeScrollerView.kt +50 -6
  10. package/android/src/main/java/com/reactnativepagerview/NestedScrollableHost.kt +8 -2
  11. package/android/src/main/java/com/reactnativepagerview/event/NativeHeaderPressEvent.kt +8 -0
  12. package/android/src/test/java/com/reactnativepagerview/NativeScrollerScrollAwayInsetsTest.kt +40 -0
  13. package/docs/SPEC.md +716 -10
  14. package/ios/RNCCollapsiblePagerViewComponentView.mm +2246 -97
  15. package/ios/RNCNativeScrollerComponentView.h +2 -0
  16. package/ios/RNCNativeScrollerComponentView.mm +42 -0
  17. package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +723 -1
  18. package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +1116 -0
  19. package/ios/tests/RNCCollapsiblePagerPressCancellationTests.mm +74 -9
  20. package/ios/tests/RNCCollapsiblePagerRefreshControlTests.mm +50 -0
  21. package/lib/module/CollapsiblePagerView.js +75 -11
  22. package/lib/module/CollapsiblePagerView.web.js +653 -8
  23. package/lib/module/CollapsiblePagerViewNativeComponent.ts +57 -42
  24. package/lib/module/NativeScroller.web.js +3 -0
  25. package/lib/module/NativeScrollerNativeComponent.ts +42 -46
  26. package/lib/module/PagerViewNativeComponent.ts +20 -25
  27. package/lib/module/WebCollapsiblePagerPage.js +7 -2
  28. package/lib/typescript/src/CollapsiblePagerView.d.ts +62 -4
  29. package/lib/typescript/src/CollapsiblePagerView.web.d.ts +56 -2
  30. package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +54 -38
  31. package/lib/typescript/src/NativeScroller.d.ts +5 -3
  32. package/lib/typescript/src/NativeScroller.web.d.ts +1 -1
  33. package/lib/typescript/src/NativeScrollerNativeComponent.d.ts +47 -48
  34. package/lib/typescript/src/PagerView.d.ts +1 -1
  35. package/lib/typescript/src/PagerView.web.d.ts +1 -1
  36. package/lib/typescript/src/PagerViewNativeComponent.d.ts +20 -21
  37. package/lib/typescript/src/WebCollapsiblePagerPage.d.ts +1 -1
  38. package/lib/typescript/src/usePagerView.d.ts +2 -2
  39. package/lib/typescript/src/utils.d.ts +2 -2
  40. package/package.json +20 -7
  41. package/react-native-pager-view.podspec +1 -0
  42. package/src/CollapsiblePagerView.tsx +208 -12
  43. package/src/CollapsiblePagerView.web.tsx +587 -7
  44. package/src/CollapsiblePagerViewNativeComponent.ts +57 -42
  45. package/src/NativeScroller.tsx +14 -4
  46. package/src/NativeScroller.web.tsx +15 -1
  47. package/src/NativeScrollerNativeComponent.ts +42 -46
  48. package/src/PagerViewNativeComponent.ts +20 -25
  49. 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
- topScrollEdgeEffect?: WithDefault<"none" | "hard" | "soft", "none">;
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
- nativeTabBarContentPaddingHorizontal?: Double;
71
- nativeTabBarItemSpacing?: Double;
72
- nativeTabBarFontSize?: Double;
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
- onNativeTabPress?: DirectEventHandler<OnNativeTabPressEventData>;
87
- onNativeSubHeaderPress?: DirectEventHandler<OnNativeTabPressEventData>;
88
- onScrollEdgeCapability?: DirectEventHandler<OnScrollEdgeCapabilityEventData>;
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",
@@ -7,7 +7,6 @@ import {
7
7
  TextInput,
8
8
  View,
9
9
  type GestureResponderEvent,
10
- type NativeMethods,
11
10
  type RefreshControlProps,
12
11
  type ScrollView,
13
12
  type ScrollViewProps,
@@ -35,7 +34,6 @@ export interface NativeScrollerProps
35
34
  | "alwaysBounceVertical"
36
35
  | "contentInset"
37
36
  | "keyboardDismissMode"
38
- | "keyboardShouldPersistTaps"
39
37
  | "scrollEventThrottle"
40
38
  | "decelerationRate"
41
39
  | "onScroll"
@@ -53,12 +51,24 @@ export interface NativeScrollerProps
53
51
  decelerationRate?: ScrollViewProps["decelerationRate"];
54
52
  /** Standard RefreshControl props are mapped to the independently owned native controller. */
55
53
  refreshControl?: React.ReactElement<RefreshControlProps>;
54
+ /** Boolean values are deprecated compatibility aliases (`true` -> `always`, `false` -> `never`). */
55
+ keyboardShouldPersistTaps?:
56
+ | ScrollViewProps["keyboardShouldPersistTaps"]
57
+ | boolean;
56
58
  }
57
59
 
58
60
  type HostRef = React.ElementRef<typeof NativeScrollerHost>;
59
61
 
60
62
  export interface NativeScrollerRef
61
- extends NativeMethods,
63
+ extends Pick<
64
+ HostRef,
65
+ | "measure"
66
+ | "measureInWindow"
67
+ | "measureLayout"
68
+ | "setNativeProps"
69
+ | "focus"
70
+ | "blur"
71
+ >,
62
72
  Pick<
63
73
  React.ElementRef<typeof ScrollView>,
64
74
  "scrollTo" | "scrollToEnd" | "flashScrollIndicators"
@@ -155,7 +165,7 @@ export const NativeScroller = React.forwardRef<
155
165
 
156
166
  React.useImperativeHandle(
157
167
  forwardedRef,
158
- () => ({
168
+ (): NativeScrollerRef => ({
159
169
  scrollTo(options, x, animated) {
160
170
  const host = hostRef.current;
161
171
  if (!host) return;
@@ -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 <ScrollView {...props} ref={setRef} {...webDataProps} />;
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,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>,
@@ -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
- requestMeasure();
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