From ee057dc788f655853e49476829a6bab2444bdbdf Mon Sep 17 00:00:00 2001 From: wwwcg Date: Mon, 18 Dec 2023 23:16:30 +0800 Subject: [PATCH] fix(ios): fix view creation bug on release mode --- renderer/native/ios/renderer/HippyUIManager.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renderer/native/ios/renderer/HippyUIManager.mm b/renderer/native/ios/renderer/HippyUIManager.mm index c2b4f882131..5d116ae701b 100644 --- a/renderer/native/ios/renderer/HippyUIManager.mm +++ b/renderer/native/ios/renderer/HippyUIManager.mm @@ -149,7 +149,7 @@ - (void)removeAllObjects { @end static void NativeRenderTraverseViewNodes(id view, void (^block)(id)) { - if (view.hippyTag) { + if (view.hippyTag != nil) { block(view); for (id subview in view.subcomponents) { NativeRenderTraverseViewNodes(subview, block); @@ -789,6 +789,7 @@ - (void)createRenderNodes:(std::vector> &&)nodes } [superRenderObject didUpdateHippySubviews]; }]; + __block NSMutableArray *tempCreatedViews = [NSMutableArray arrayWithCapacity:nodes.size()]; // Used to temporarily hold views objects. for (const std::shared_ptr &node : nodes) { NSNumber *componentTag = @(node->GetId()); HippyShadowView *shadowView = [_shadowViewRegistry componentForTag:componentTag onRootTag:rootNodeTag]; @@ -804,6 +805,7 @@ - (void)createRenderNodes:(std::vector> &&)nodes [uiManager->_componentTransactionListeners addObject:view]; } [uiManager.viewRegistry addComponent:view forRootTag:shadowView.rootTag]; + [tempCreatedViews addObject:view]; // TODO: hippy3 events binding handling, performance needs to be improved here. const std::vector &eventNames = [shadowView allEventNames];