From a98f3421914f323dff0e6286f2ca18bac6661bc3 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 19 Mar 2019 21:14:14 -0700 Subject: [PATCH] Reorder prepareForRecycle before adding recycle pool (#24025) Summary: Put `prepareForRecycle` to last before enqueue to recycle pool, ensure only call it when count lower than RCTComponentViewRegistryRecyclePoolMaxSize. cc. shergin . [General] [Changed] - Reorder prepareForRecycle before adding recycle pool Pull Request resolved: https://github.com/facebook/react-native/pull/24025 Differential Revision: D14536843 Pulled By: shergin fbshipit-source-id: 82a816e2c0afb5a6bb72637d7d55d6a4fda708af --- React/Fabric/Mounting/RCTComponentViewRegistry.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index 1d232ef3118..c1e18b7bee7 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -205,8 +205,6 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024; componentView:(UIView *)componentView { RCTAssertMainQueue(); - [componentView prepareForRecycle]; - NSHashTable *> *componentViews = [_recyclePool objectForKey:(__bridge id)(void *)componentHandle]; if (!componentViews) { @@ -218,6 +216,7 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024; return; } + [componentView prepareForRecycle]; [componentViews addObject:componentView]; }