mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-17 04:41:51 +08:00
fix(ohos): fix attach window event to js
This commit is contained in:
+2
@@ -195,6 +195,8 @@ protected:
|
||||
std::function<void(const HRPosition &screenPosition)> eventTouchCancel_;
|
||||
std::function<void()> eventAttachedToWindow_;
|
||||
std::function<void()> eventDetachedFromWindow_;
|
||||
|
||||
bool attachEventHasSend_ = false;
|
||||
|
||||
bool flagInterceptPullUp_ = false;
|
||||
|
||||
|
||||
@@ -834,11 +834,12 @@ void BaseView::SetAttachedToWindowHandle(bool flag) {
|
||||
eventAttachedToWindow_ = [weak_view]() {
|
||||
auto view = weak_view.lock();
|
||||
if (view) {
|
||||
view->attachEventHasSend_ = true;
|
||||
HRGestureDispatcher::HandleAttachedToWindow(view->ctx_, view->tag_);
|
||||
}
|
||||
};
|
||||
// NODE_EVENT_ON_ATTACH 事件是 insertChild 的时候触发的,所以如果已经 insert 过,需要补发事件
|
||||
if (GetLocalRootArkUINode()->HasParent()) {
|
||||
if (GetLocalRootArkUINode()->HasParent() && !attachEventHasSend_) {
|
||||
eventAttachedToWindow_();
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user