From ffd2409172ac5ddda452bce1c0f73f7455c09a59 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 26 Nov 2018 13:48:56 -0800 Subject: [PATCH] Fabric: Proper implementation of -[RCTViewComponentView prepareForRecycle] Summary: RCTViewComponentView retains an EventEmitter, so we have to clear this up after we recyled the view. Reviewed By: sahrens Differential Revision: D13196884 fbshipit-source-id: e9f2e2400be864c5c6177227255012101ed8c4d1 --- .../Mounting/ComponentViews/View/RCTViewComponentView.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 7688d0d5f..d9e3884c1 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -267,6 +267,12 @@ using namespace facebook::react; [self invalidateLayer]; } +- (void)prepareForRecycle +{ + [super prepareForRecycle]; + _eventEmitter.reset(); +} + - (UIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event { // This is a classic textbook implementation of `hitTest:` with a couple of improvements: