From 3ff671c70433b90f511c9008323bad598336c19d Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 16 Jun 2020 09:57:10 -0700 Subject: [PATCH] Do not retain paper view inside legacy interop after it has been recycled Summary: Changelog: [Internal] Paper views are not designed to be recycled, that's why a new view is created each time legacy interop layer is used. However paper view was not deallocated immediately after it was used, it was still being strongly referenced by `self.contentView`. This doesn't cause an immediate issue because eventually when legacy interop layer does get reused, it will create a new paper view and replace the old one inside `self.contentView`, triggering deallocation of the old one. But we were retaining the paper view beyond what was necessary. Reviewed By: mdvacca Differential Revision: D22066022 fbshipit-source-id: 17c3b81468f50ebcc05f1a7cdf4d4b9b00965fc3 --- .../RCTLegacyViewManagerInteropComponentView.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index afd1873bacf..10e78de2937 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -87,6 +87,7 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index"; [_viewsToBeMounted removeAllObjects]; [_viewsToBeUnmounted removeAllObjects]; _state.reset(); + self.contentView = nil; [super prepareForRecycle]; }