issueNo: I4BP9Z

Description: make events non bubbling by default if api version lower than 5
Feature or Bugfix:Bugfix
Binary Source:No

Signed-off-by: youzhi92 <chenyouzhi@huawei.com>
Change-Id: I019414b23d3a485ffbda4379ab91e98c56ec6fa8
This commit is contained in:
youzhi92
2021-09-24 16:32:08 +08:00
parent 7de8ea2fda
commit 0cc96eaf26
@@ -137,6 +137,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