You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2019/08/09 07:19:50 UTC

[incubator-weex-site] branch master updated: [IOS]div增加eventPenetrationEnabled和userInteractionEnabled属性,管理事件传递 (#477)

This is an automated email from the ASF dual-hosted git repository.

kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex-site.git


The following commit(s) were added to refs/heads/master by this push:
     new e9cb7d8  [IOS]div增加eventPenetrationEnabled和userInteractionEnabled属性,管理事件传递 (#477)
e9cb7d8 is described below

commit e9cb7d8dfcc3e0197ff720d7ddcbdbd8daa602da
Author: 宣天鹏 <12...@qq.com>
AuthorDate: Fri Aug 9 15:19:45 2019 +0800

    [IOS]div增加eventPenetrationEnabled和userInteractionEnabled属性,管理事件传递 (#477)
---
 docs/docs/events/common-events.md    | 15 +++++++++++++++
 docs/zh/docs/events/common-events.md | 16 ++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/docs/docs/events/common-events.md b/docs/docs/events/common-events.md
index 9720c38..8a10b1b 100644
--- a/docs/docs/events/common-events.md
+++ b/docs/docs/events/common-events.md
@@ -10,6 +10,21 @@ version: 2.1
 
 Weex provide the ability to let events trigger action, like starting a JavaScript when a user click on a component. Below are the common event attributes that can be added to weex components to define event actions.
 
+## Event penetration
+
+**Notes: ** The principle of native event delivery under `Android` and `iOS` is different, only for `iOS` here.
+
+When a parent view has multiple peer views, iOS will select the highest level View to respond to the event, and the underlying view event will never be responded.
+
+Weex add attribute `eventPenetrationEnabled` to `<div>` component. When the value is `true`, the view's children views still respond to the event normally, while the view itself will not respond to the event, but pass the event to the lower level View.
+
+[Event penetration](https://jsplayground.taobao.org/raxplayground/c230a32e-489c-4fda-ae90-40faa6aaafbc??from=)
+
+## View interactivity
+
+Weex add attribute `userInteractionEnabled` to `<div>` component. When the value is `true`, neither the view nor its children views respond to the event. The event is passed to the lower layer View.
+
+
 ## Click event
 
 The onclick attribute fires on a click gesture on the element.
diff --git a/docs/zh/docs/events/common-events.md b/docs/zh/docs/events/common-events.md
index 23cb530..98cc1c9 100644
--- a/docs/zh/docs/events/common-events.md
+++ b/docs/zh/docs/events/common-events.md
@@ -2,6 +2,22 @@
 
 Weex 提供了通过事件触发动作的能力,例如在用户点击组件时执行 JavaScript。下面列出了可被添加到 Weex 组件上以定义事件动作的属性:
 
+## 事件穿透
+
+::: warning 注意
+`Android`和`iOS`下原生事件传递机制不同,这里仅针对`iOS`
+:::
+
+当一个父View存在多个同级子View时,由于`iOS`会选择层级最高的View来响应事件,底层的View的事件永远都不会响应。
+
+Weex在`<div>`组件中增加了`eventPenetrationEnabled`属性,当值为`true`时,View的子View仍能正常响应事件,但View自身将不会响应事件,而是将事件向下层View传递。
+
+[示例](https://jsplayground.taobao.org/raxplayground/c230a32e-489c-4fda-ae90-40faa6aaafbc??from=)
+
+## View交互性
+
+Weex在`<div>`组件中增加了`userInteractionEnabled`属性,当值为`true`时,View及其子View均不响应事件 事件向下层View传递
+
 ## click
 
 当组件上发生点击手势时被触发。