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
This commit is contained in:
zhongwuzw
2019-03-19 21:14:14 -07:00
committed by Facebook Github Bot
parent e67aa427a8
commit a98f342191
@@ -205,8 +205,6 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
componentView:(UIView<RCTComponentViewProtocol> *)componentView
{
RCTAssertMainQueue();
[componentView prepareForRecycle];
NSHashTable<UIView<RCTComponentViewProtocol> *> *componentViews =
[_recyclePool objectForKey:(__bridge id)(void *)componentHandle];
if (!componentViews) {
@@ -218,6 +216,7 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
return;
}
[componentView prepareForRecycle];
[componentViews addObject:componentView];
}