Skip to content

Commit

Permalink
docs(react,vue): update docs of pointerEvents prop
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Oct 8, 2024
1 parent 2d9f119 commit e87fb7c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
27 changes: 26 additions & 1 deletion docs/api/hippy-react/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,32 @@ import icon from './qb_icon_new.png';
| onTouchMove | 当用户在控件移动手指时,此函数会持续收到回调,并通过event参数告知控件的触屏点信息;参数为 `nativeEvent: { name, page_x, page_y, id }``page_x``page_y` 分别表示点击在屏幕内的绝对位置 | `Function` | `Android、iOS、hippy-react-web、Web-Renderer、Voltron` |
| onTouchEnd | 当触屏操作结束,用户在该控件上抬起手指时,此函数将被回调,event参数也会通知当前的触屏点信息;参数为 `nativeEvent: { name, page_x, page_y, id }``page_x``page_y` 分别表示点击在屏幕内的绝对位置 | `Function` | `Android、iOS、hippy-react-web、Web-Renderer、Voltron` |
| onTouchCancel | 当用户触屏过程中,某个系统事件中断了触屏,例如电话呼入、组件变化(如设置为hidden)、其他组件的滑动手势,此函数会收到回调,触屏点信息也会通过event参数告知前端;参数为 `nativeEvent: { name, page_x, page_y, id }``page_x``page_y` 分别表示点击在屏幕内的绝对位置 | `Function` | `Android、iOS、hippy-react-web、Web-Renderer、Voltron` |

| pointerEvents | 用于控制视图是否可以成为触摸事件的目标。 | `enum('box-none', 'none', 'box-only', 'auto')` | `iOS` |

* pointerEvents 的参数含义:
* `auto`(默认值) - 视图可以是触摸事件的目标;
* `none` - 视图永远不是触摸事件的目标;
* `box-none` - 视图不是触摸事件的目标,但它的子视图可以是。其行为类似视图在CSS中有以下类:

```css
.box-none {
pointer-events: none;
}
.box-none * {
pointer-events: auto;
}
```

* `box-only` - 视图可以是触摸事件的目标,但它的子视图不能。其行为类似视图在CSS中有以下类:

```css
.box-only {
pointer-events: auto;
}
.box-only * {
pointer-events: none;
}
```

## 方法

Expand Down
26 changes: 26 additions & 0 deletions docs/api/hippy-vue/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,32 @@
| showsHorizontalScrollIndicator | 当此值设为 `false` 的时候,`ScrollView` 会隐藏水平的滚动条。`default: true` `(仅在 overflow-y/x: scroll 时适用)`| `boolean` | `iOS、Voltron` |
| showsVerticalScrollIndicator | 当此值设为 `false` 的时候,`ScrollView` 会隐藏垂直的滚动条。 `default: true` `(仅在 overflow-y/x: scroll 时适用)`| `boolean` | `iOS、Voltron` |
| nativeBackgroundAndroid | 配置水波纹效果,`最低支持版本 2.13.1`;配置项为 `{ borderless: boolean, color: Color, rippleRadius: number }``borderless` 表示波纹是否有边界,默认false;`color` 波纹颜色;`rippleRadius` 波纹半径,若不设置,默认容器边框为边界; `注意:设置水波纹后默认不显示,需要在对应触摸事件中调用 setPressed 和 setHotspot 方法进行水波纹展示,详情参考相关`[demo](//github.com/Tencent/Hippy/tree/master/examples/hippy-vue-demo/src/components/demos/demo-div.vue) | `Object`| `Android` |
| pointerEvents | 用于控制视图是否可以成为触摸事件的目标。 | `enum('box-none', 'none', 'box-only', 'auto')` | `iOS` |

* pointerEvents 的参数含义:
* `auto`(默认值) - 视图可以是触摸事件的目标;
* `none` - 视图永远不是触摸事件的目标;
* `box-none` - 视图不是触摸事件的目标,但它的子视图可以是。其行为类似视图在CSS中有以下类:

```css
.box-none {
pointer-events: none;
}
.box-none * {
pointer-events: auto;
}
```

* `box-only` - 视图可以是触摸事件的目标,但它的子视图不能。其行为类似视图在CSS中有以下类:

```css
.box-only {
pointer-events: auto;
}
.box-only * {
pointer-events: none;
}
```

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (UIView *)view {


HIPPY_EXPORT_METHOD(getContentSize:(nonnull NSNumber *)hippyTag
callback:(HippyPromiseResolveBlock)callback) {
callback:(nonnull HippyPromiseResolveBlock)callback) {
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *,__kindof UIView *> *viewRegistry) {
HippyScrollView *view = viewRegistry[hippyTag];
CGSize size = view.scrollView.contentSize;
Expand All @@ -98,9 +98,9 @@ - (UIView *)view {
}

HIPPY_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)hippyTag
offsetX:(NSNumber *)x
offsetY:(NSNumber *)y
animated:(NSNumber *)animated) {
offsetX:(nonnull NSNumber *)x
offsetY:(nonnull NSNumber *)y
animated:(nonnull NSNumber *)animated) {
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
UIView *view = viewRegistry[hippyTag];
if (view == nil) return ;
Expand All @@ -114,7 +114,7 @@ - (UIView *)view {
}

HIPPY_EXPORT_METHOD(scrollToWithOptions:(nonnull NSNumber *)hippyTag
options:(NSDictionary *)options) {
options:(nullable NSDictionary *)options) {
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
UIView *view = viewRegistry[hippyTag];
if (view == nil) return ;
Expand Down

0 comments on commit e87fb7c

Please sign in to comment.