@onekeyfe/react-native-pager-view 3.0.158 → 3.0.160

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 (42) hide show
  1. package/README.md +57 -4
  2. package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerHost.kt +379 -31
  3. package/android/src/main/java/com/reactnativepagerview/NativeScrollCoordinatorContributions.kt +15 -0
  4. package/android/src/main/java/com/reactnativepagerview/NativeScrollerPendingRestore.kt +26 -0
  5. package/android/src/main/java/com/reactnativepagerview/NativeScrollerScrollAwayInsets.kt +41 -0
  6. package/android/src/main/java/com/reactnativepagerview/NativeScrollerView.kt +600 -0
  7. package/android/src/main/java/com/reactnativepagerview/NativeScrollerViewManager.kt +145 -0
  8. package/android/src/main/java/com/reactnativepagerview/PagerViewViewPackage.kt +1 -1
  9. package/android/src/main/jni/CMakeLists.txt +19 -0
  10. package/android/src/main/jni/pagerview.h +11 -0
  11. package/android/src/main/res/values/native_scroll_coordinator_ids.xml +5 -0
  12. package/android/src/test/java/com/reactnativepagerview/NativeScrollCoordinatorContributionsTest.kt +26 -0
  13. package/android/src/test/java/com/reactnativepagerview/NativeScrollerPendingRestoreTest.kt +31 -0
  14. package/android/src/test/java/com/reactnativepagerview/NativeScrollerScrollAwayInsetsTest.kt +75 -0
  15. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerComponentDescriptor.h +8 -0
  16. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerShadowNode.cpp +15 -0
  17. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerShadowNode.h +23 -0
  18. package/common/cpp/react/renderer/components/pagerview/RNCNativeScrollerState.h +33 -0
  19. package/docs/SPEC.md +450 -0
  20. package/ios/RNCCollapsiblePagerReleasedStatePolicy.h +8 -0
  21. package/ios/RNCCollapsiblePagerReleasedStatePolicy.m +13 -0
  22. package/ios/RNCCollapsiblePagerViewComponentView.mm +414 -1
  23. package/ios/RNCNativeScrollerComponentView.h +17 -0
  24. package/ios/RNCNativeScrollerComponentView.mm +479 -0
  25. package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +80 -0
  26. package/ios/tests/RNCCollapsiblePagerPressCancellationTests.mm +788 -0
  27. package/ios/tests/RNCCollapsiblePagerPressCancellationWiringTests.mm +109 -0
  28. package/ios/tests/RNCCollapsiblePagerRefreshControlTests.mm +218 -0
  29. package/ios/tests/RNCCollapsiblePagerReleasedStatePolicyTests.mm +23 -0
  30. package/ios/tests/RNCNativeScrollerTests.mm +252 -0
  31. package/lib/module/CollapsiblePagerView.js +10 -1
  32. package/lib/module/NativeScroller.js +171 -11
  33. package/lib/module/NativeScrollerNativeComponent.ts +101 -0
  34. package/lib/typescript/src/CollapsiblePagerView.d.ts +3 -3
  35. package/lib/typescript/src/NativeScroller.d.ts +15 -7
  36. package/lib/typescript/src/NativeScrollerNativeComponent.d.ts +79 -0
  37. package/package.json +8 -4
  38. package/react-native-pager-view.podspec +2 -1
  39. package/react-native.config.js +15 -0
  40. package/src/CollapsiblePagerView.tsx +14 -4
  41. package/src/NativeScroller.tsx +291 -14
  42. package/src/NativeScrollerNativeComponent.ts +101 -0
package/README.md CHANGED
@@ -68,10 +68,63 @@ Web scroll child can opt in by exposing a DOM element with
68
68
  movement, so React is not updated on each vertical scroll frame.
69
69
 
70
70
  On iOS and Android, `nativeTabBar` renders the tab bar natively and
71
- `onNativeTabPress` reports presses. A press animates to the pressed page by
72
- default. Set `nativeTabPressAnimationEnabled={false}` to jump straight there,
73
- so pressing a distant tab does not scroll through every page in between,
74
- including unmounted pages that would show blank.
71
+ `onNativeTabPress` reports presses. By default, adjacent tab presses animate and
72
+ non-adjacent presses jump directly to the target without passing intermediate
73
+ pages. Set `nativeTabPressAnimationEnabled={true}` to always animate, or `false`
74
+ to always jump. Swipe gestures and imperative page commands are unchanged.
75
+
76
+ > **Behavior change:** earlier versions animated every native tab press when
77
+ > `nativeTabPressAnimationEnabled` was omitted. Pass
78
+ > `nativeTabPressAnimationEnabled={true}` to keep that behavior.
75
79
 
76
80
  Thank you again to Callstack and everyone who contributes to
77
81
  `react-native-pager-view` 💙
82
+
83
+ The native ancestor-scroll contribution protocol is specified in [docs/SPEC.md](docs/SPEC.md).
84
+
85
+ ## NativeScroller compatibility
86
+
87
+ The independent iOS/Android `NativeScroller` has passing native builds and
88
+ focused simulator checks. The complete acceptance matrix remains open; see
89
+ [docs/SPEC.md](docs/SPEC.md) for the verified cases and limits. It is a
90
+ non-virtualized vertical scroller with one internal React content View. Fabric/Yoga lays out React children and content padding; size
91
+ changes are sent to native through layout props, not a JavaScript scroll loop.
92
+ Shared Fabric native state tracks local scroll displacement and ancestor header
93
+ travel separately, without per-frame JavaScript coordination. Descendant hit
94
+ testing and `measureInWindow` use that state; device acceptance must compare the
95
+ reported coordinates with visible React content after scrolling and page return.
96
+ The automatic flexGrow minimum uses a native-reported usable content height,
97
+ with static pager reservations accounted for once. This internal size event is
98
+ not public API and does not run on scroll frames. Before it arrives the automatic
99
+ minimum is zero; a larger explicit numeric minHeight remains authoritative.
100
+ Refresh insets and content-dependent bottom fill do not change this minimum.
101
+ Web continues using its existing ScrollView implementation.
102
+
103
+ The supported ScrollView subset is `contentContainerStyle` (including padding,
104
+ height, numeric minHeight and flexGrow), `onContentSizeChange`, `scrollEnabled`,
105
+ `nestedScrollEnabled`, indicators, `bounces`, `alwaysBounceVertical`,
106
+ `contentInset`, keyboard dismissal/persist-tap modes, `scrollEventThrottle`, and
107
+ the scroll/drag/momentum callbacks. Standard View props remain available.
108
+ `decelerationRate` applies on iOS; Android uses AndroidX's native fling physics.
109
+ `bounces`/`alwaysBounceVertical` and refresh tint/title are iOS controls; Android
110
+ uses refresh colors/background/size and does not expose a bounce policy here.
111
+ Tap-to-dismiss uses RN 0.86's JavaScript TextInput registry to preserve taps on
112
+ another input and child-handled presses; keyboard behavior requires device checks.
113
+ Horizontal scrolling, sticky rows, snapping, zoom, automatic keyboard insets and
114
+ the full ScrollView responder API are not provided.
115
+
116
+ Pass a standard `<RefreshControl refreshing={value} onRefresh={callback} />` as
117
+ `refreshControl`. Its enabled, tint/colors, background, offset, title/title color
118
+ and size props map to the component's native refresh controller; the RN refresh
119
+ element is not mounted. Refreshing remains controlled even if the callback does
120
+ not change the value. Arbitrary custom refresh components are not supported.
121
+
122
+ `NativeScrollerRef` exposes `scrollTo`, `scrollToEnd`, `flashScrollIndicators`,
123
+ host measurement/focus methods, `getNativeScrollRef` and `getScrollableNode`.
124
+ `pagerScrollKey` remains the stable primary-scroller identity. Native command
125
+ events use the ScrollView event shape; UIKit/AndroidX continue owning gestures
126
+ and momentum. Animated commands whose clamped target differs from the current
127
+ position emit a momentum begin/end pair; a no-op emits no new pair. A new command,
128
+ new touch, content-root replacement or detach ends the previous active sequence.
129
+ The focused JS tests verify wrapper routing, not native scrolling,
130
+ Yoga rendering, keyboard interaction or refresh placement on a device.