@onekeyfe/react-native-pager-view 3.0.157-alpha.257 → 3.0.157-alpha.262

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 (35) hide show
  1. package/README.md +55 -4
  2. package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerHost.kt +295 -59
  3. package/android/src/main/java/com/reactnativepagerview/NativeScrollerPendingRestore.kt +26 -0
  4. package/android/src/main/java/com/reactnativepagerview/NativeScrollerScrollAwayInsets.kt +15 -11
  5. package/android/src/main/java/com/reactnativepagerview/NativeScrollerView.kt +600 -0
  6. package/android/src/main/java/com/reactnativepagerview/NativeScrollerViewManager.kt +145 -0
  7. package/android/src/main/java/com/reactnativepagerview/PagerViewViewPackage.kt +1 -1
  8. package/android/src/main/jni/CMakeLists.txt +19 -0
  9. package/android/src/main/jni/pagerview.h +11 -0
  10. package/android/src/main/res/values/native_scroll_coordinator_ids.xml +1 -0
  11. package/android/src/test/java/com/reactnativepagerview/NativeScrollerPendingRestoreTest.kt +31 -0
  12. package/android/src/test/java/com/reactnativepagerview/NativeScrollerScrollAwayInsetsTest.kt +32 -52
  13. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerComponentDescriptor.h +8 -0
  14. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerShadowNode.cpp +15 -0
  15. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerShadowNode.h +23 -0
  16. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerState.h +33 -0
  17. package/docs/SPEC.md +282 -34
  18. package/ios/RNCCollapsiblePagerViewComponentView.mm +187 -1
  19. package/ios/RNCNativeScrollerComponentView.h +17 -0
  20. package/ios/RNCNativeScrollerComponentView.mm +479 -0
  21. package/ios/tests/RNCCollapsiblePagerPressCancellationTests.mm +759 -0
  22. package/ios/tests/RNCCollapsiblePagerPressCancellationWiringTests.mm +109 -0
  23. package/ios/tests/RNCNativeScrollerTests.mm +252 -0
  24. package/lib/module/CollapsiblePagerView.js +10 -1
  25. package/lib/module/NativeScroller.js +171 -11
  26. package/lib/module/NativeScrollerNativeComponent.ts +101 -0
  27. package/lib/typescript/src/CollapsiblePagerView.d.ts +3 -3
  28. package/lib/typescript/src/NativeScroller.d.ts +15 -7
  29. package/lib/typescript/src/NativeScrollerNativeComponent.d.ts +79 -0
  30. package/package.json +7 -4
  31. package/react-native-pager-view.podspec +2 -1
  32. package/react-native.config.js +15 -0
  33. package/src/CollapsiblePagerView.tsx +14 -4
  34. package/src/NativeScroller.tsx +291 -14
  35. package/src/NativeScrollerNativeComponent.ts +101 -0
@@ -0,0 +1,101 @@
1
+ import type * as React from "react";
2
+ import {
3
+ codegenNativeCommands,
4
+ codegenNativeComponent,
5
+ type ColorValue,
6
+ type HostComponent,
7
+ type ViewProps,
8
+ } from "react-native";
9
+ import type {
10
+ DirectEventHandler,
11
+ Double,
12
+ WithDefault,
13
+ } from "react-native/Libraries/Types/CodegenTypes";
14
+
15
+ export type NativeScrollerScrollEvent = Readonly<{
16
+ contentInset: Readonly<{
17
+ top: Double;
18
+ right: Double;
19
+ bottom: Double;
20
+ left: Double;
21
+ }>;
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;
28
+ }>;
29
+
30
+ 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<
41
+ "never" | "always" | "handled",
42
+ "never"
43
+ >;
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
+ refreshEnabled?: WithDefault<boolean, false>;
51
+ refreshing?: WithDefault<boolean, false>;
52
+ refreshTintColor?: ColorValue;
53
+ refreshColors?: ReadonlyArray<ColorValue>;
54
+ refreshProgressBackgroundColor?: ColorValue;
55
+ refreshProgressViewOffset?: WithDefault<Double, 0>;
56
+ refreshTitle?: string;
57
+ refreshTitleColor?: ColorValue;
58
+ refreshSize?: WithDefault<"default" | "large", "default">;
59
+ onContentViewportChange?: DirectEventHandler<Readonly<{ height: Double }>>;
60
+ onRefresh?: DirectEventHandler<null>;
61
+ onScroll?: DirectEventHandler<NativeScrollerScrollEvent>;
62
+ onScrollBeginDrag?: DirectEventHandler<NativeScrollerScrollEvent>;
63
+ onScrollEndDrag?: DirectEventHandler<NativeScrollerScrollEvent>;
64
+ onMomentumScrollBegin?: DirectEventHandler<NativeScrollerScrollEvent>;
65
+ onMomentumScrollEnd?: DirectEventHandler<NativeScrollerScrollEvent>;
66
+ }
67
+
68
+ type NativeScrollerHost = HostComponent<NativeProps>;
69
+
70
+ export interface NativeCommands {
71
+ scrollTo: (
72
+ viewRef: React.ElementRef<NativeScrollerHost>,
73
+ x: Double,
74
+ y: Double,
75
+ animated: boolean
76
+ ) => void;
77
+ scrollToEnd: (
78
+ viewRef: React.ElementRef<NativeScrollerHost>,
79
+ animated: boolean
80
+ ) => void;
81
+ flashScrollIndicators: (
82
+ viewRef: React.ElementRef<NativeScrollerHost>
83
+ ) => void;
84
+ setRefreshState: (
85
+ viewRef: React.ElementRef<NativeScrollerHost>,
86
+ refreshing: boolean
87
+ ) => void;
88
+ }
89
+
90
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
91
+ supportedCommands: [
92
+ "scrollTo",
93
+ "scrollToEnd",
94
+ "flashScrollIndicators",
95
+ "setRefreshState",
96
+ ],
97
+ });
98
+
99
+ export default codegenNativeComponent<NativeProps>("RNCNativeScroller", {
100
+ interfaceOnly: true,
101
+ }) as NativeScrollerHost;