diff --git a/packages/react-native/React/Views/RCTView.m b/packages/react-native/React/Views/RCTView.m index f8fc24487bc33f..1c9e45862ad73b 100644 --- a/packages/react-native/React/Views/RCTView.m +++ b/packages/react-native/React/Views/RCTView.m @@ -1492,16 +1492,21 @@ - (BOOL)acceptsFirstResponder - (void)updateTrackingAreas { - if (_trackingArea) { - [self removeTrackingArea:_trackingArea]; - } + BOOL hasMouseHoverEvent = self.onMouseEnter || self.onMouseLeave; + BOOL wouldRecreateIdenticalTrackingArea = hasMouseHoverEvent && _trackingArea && NSEqualRects(self.bounds, [_trackingArea rect]); + + if (!wouldRecreateIdenticalTrackingArea) { + if (_trackingArea) { + [self removeTrackingArea:_trackingArea]; + } - if (self.onMouseEnter || self.onMouseLeave) { - _trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds - options:NSTrackingActiveAlways|NSTrackingMouseEnteredAndExited - owner:self - userInfo:nil]; - [self addTrackingArea:_trackingArea]; + if (hasMouseHoverEvent) { + _trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds + options:NSTrackingActiveAlways|NSTrackingMouseEnteredAndExited + owner:self + userInfo:nil]; + [self addTrackingArea:_trackingArea]; + } } [super updateTrackingAreas];