mirror of
https://github.com/openharmony/ace_engine_lite.git
synced 2026-07-21 00:35:30 -04:00
!380 事件冒泡机制从API version 5开始支持,且事件默认是冒泡的。但应兼容迁移过来的旧应用(API version4)使其默认不冒泡。
Merge pull request !380 from youzhi92/cherry-pick-1632472488
This commit is contained in:
@@ -130,6 +130,18 @@ bool Component::Render()
|
||||
}
|
||||
STOP_TRACING();
|
||||
|
||||
// The event bubbling mechanism is supported from API version 5, and events are bubbled by default.
|
||||
// However, it should be compatible with the migrated old application (API version 4)
|
||||
// so that it does not bubble by default.
|
||||
const int32_t supportEventBubbleApiVersion = 5;
|
||||
if (JsAppContext::GetInstance()->GetTargetApi() < supportEventBubbleApiVersion) {
|
||||
UIView *view = GetComponentRootView();
|
||||
if (view != nullptr) {
|
||||
// make events non bubbling by default.
|
||||
view->SetIntercept(true);
|
||||
}
|
||||
}
|
||||
|
||||
SetViewExtraMsg();
|
||||
|
||||
// step2: binding js object with this component
|
||||
|
||||
Reference in New Issue
Block a user