diff --git a/React/Fabric/Mounting/RCTComponentViewDescriptor.h b/React/Fabric/Mounting/RCTComponentViewDescriptor.h index b59fb32748d283..62e3a5041837f5 100644 --- a/React/Fabric/Mounting/RCTComponentViewDescriptor.h +++ b/React/Fabric/Mounting/RCTComponentViewDescriptor.h @@ -22,7 +22,7 @@ class RCTComponentViewDescriptor final { * Associated (and owned) native view instance. */ __strong RCTUIView *view = nil; // [macOS] - + NSInteger tag = 0; // [macOS] default is 0 /* * Indicates a requirement to call on the view methods from * `RCTMountingTransactionObserving` protocol. diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index e08a3c199dcb69..d21aebc749503c 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -83,7 +83,11 @@ - (void)preallocateViewComponents @"RCTComponentViewRegistry: Attempt to dequeue already registered component."); auto componentViewDescriptor = [self _dequeueComponentViewWithComponentHandle:componentHandle]; +#if !TARGET_OS_OSX // [macOS] componentViewDescriptor.view.tag = tag; +#else // [macOS + componentViewDescriptor.tag = tag; +#endif // macOS] auto it = _registry.insert({tag, componentViewDescriptor}); return it.first->second; } @@ -98,7 +102,11 @@ - (void)enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle _registry.find(tag) != _registry.end(), @"RCTComponentViewRegistry: Attempt to enqueue unregistered component."); _registry.erase(tag); +#if !TARGET_OS_OSX // [macOS] componentViewDescriptor.view.tag = 0; +#else // [macOS + componentViewDescriptor.tag = 0; +#endif // macOS] [self _enqueueComponentViewWithComponentHandle:componentHandle componentViewDescriptor:componentViewDescriptor]; }