File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
packages/react-native/React/Fabric/Mounting/ComponentViews/View Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -1761,21 +1761,22 @@ - (void)viewDidMoveToWindow
1761
1761
1762
1762
- (void )updateTrackingAreas
1763
1763
{
1764
- if (_trackingArea) {
1765
- [self removeTrackingArea: _trackingArea];
1766
- }
1767
-
1768
1764
BOOL hasMouseEventHandler =
1769
1765
_props->hostPlatformEvents [HostPlatformViewEvents::Offset::MouseEnter] ||
1770
1766
_props->hostPlatformEvents [HostPlatformViewEvents::Offset::MouseLeave];
1767
+ BOOL wouldRecreateIdenticalTrackingArea =
1768
+ hasMouseEventHandler && _trackingArea && NSEqualRects (self.bounds , [_trackingArea rect ]);
1771
1769
1772
- if (hasMouseEventHandler) {
1773
- _trackingArea = [[NSTrackingArea alloc ] initWithRect: self .bounds
1774
- options: NSTrackingActiveAlways | NSTrackingMouseEnteredAndExited
1775
- owner: self
1776
- userInfo: nil ];
1777
- [self addTrackingArea: _trackingArea];
1778
- [self updateMouseOverIfNeeded ];
1770
+ if (!wouldRecreateIdenticalTrackingArea) {
1771
+ [self removeTrackingArea: _trackingArea];
1772
+ if (hasMouseEventHandler) {
1773
+ _trackingArea = [[NSTrackingArea alloc ] initWithRect: self .bounds
1774
+ options: NSTrackingActiveAlways|NSTrackingMouseEnteredAndExited
1775
+ owner: self
1776
+ userInfo: nil ];
1777
+ [self addTrackingArea: _trackingArea];
1778
+ [self updateMouseOverIfNeeded ];
1779
+ }
1779
1780
}
1780
1781
1781
1782
[super updateTrackingAreas ];
You can’t perform that action at this time.
0 commit comments