@onekeyfe/react-native-scroll-guard 3.0.162 → 3.0.165
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/README.md +56 -0
- package/package.json +7 -3
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @onekeyfe/react-native-scroll-guard
|
|
2
|
+
|
|
3
|
+
Native gesture coordination for scrollable content inside a React Native pager.
|
|
4
|
+
The Nitro view helps a nested scroller retain its intended scroll gestures
|
|
5
|
+
instead of allowing the parent pager to take them. It supports iOS and Android
|
|
6
|
+
with separate platform implementations.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
yarn add @onekeyfe/react-native-scroll-guard react-native-nitro-modules
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Install the application's iOS pods and rebuild the native application. The
|
|
15
|
+
package requires a native Nitro view and a compatible scroll/pager hierarchy;
|
|
16
|
+
it does not provide a pager or render scroll content itself.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { ScrollView, Text } from 'react-native';
|
|
22
|
+
import {
|
|
23
|
+
ScrollGuardDirection,
|
|
24
|
+
ScrollGuardView,
|
|
25
|
+
} from '@onekeyfe/react-native-scroll-guard';
|
|
26
|
+
|
|
27
|
+
<ScrollGuardView direction={ScrollGuardDirection.HORIZONTAL}>
|
|
28
|
+
<ScrollView horizontal>
|
|
29
|
+
<Text>Scrollable content inside the pager</Text>
|
|
30
|
+
</ScrollView>
|
|
31
|
+
</ScrollGuardView>;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`direction` accepts `HORIZONTAL`, `VERTICAL` or `BOTH`, and defaults to horizontal.
|
|
35
|
+
There are no additional imperative methods. The full prop definition is in
|
|
36
|
+
[src/ScrollGuard.nitro.ts](src/ScrollGuard.nitro.ts).
|
|
37
|
+
|
|
38
|
+
## Platform integration
|
|
39
|
+
|
|
40
|
+
On Android the native FrameLayout blocks ancestor touch interception for the
|
|
41
|
+
guarded direction and lets child views process the gesture. It releases the
|
|
42
|
+
unguarded direction so ancestor scrolling can continue.
|
|
43
|
+
|
|
44
|
+
On iOS the native view finds an ancestor paging UIScrollView and a sibling child
|
|
45
|
+
UIScrollView, then attaches gesture coordination to that child. The iOS guard
|
|
46
|
+
passes hit testing through rather than acting as a touch target. A standalone
|
|
47
|
+
guard outside that hierarchy has no compatible scroller to coordinate.
|
|
48
|
+
|
|
49
|
+
Place the guard according to the platform's native hierarchy and verify nested
|
|
50
|
+
scrolling, page changes and ordinary taps in the actual consumer. Setting a
|
|
51
|
+
direction does not establish that an arbitrary third-party pager integration is
|
|
52
|
+
supported, and this package has no Web gesture implementation.
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-scroll-guard",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.165",
|
|
4
4
|
"description": "A native view wrapper that prevents parent scrollable containers (PagerView/ViewPager2) from intercepting child scroll gestures",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -49,10 +49,14 @@
|
|
|
49
49
|
"scroll",
|
|
50
50
|
"pager"
|
|
51
51
|
],
|
|
52
|
-
"
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-views/react-native-scroll-guard#readme",
|
|
53
56
|
"repository": {
|
|
54
57
|
"type": "git",
|
|
55
|
-
"url": "git+https://github.com/OneKeyHQ/app-modules.git"
|
|
58
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
59
|
+
"directory": "native-views/react-native-scroll-guard"
|
|
56
60
|
},
|
|
57
61
|
"author": "@onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
58
62
|
"license": "MIT",
|