diff --git a/packages/react-native/React/Modules/RCTUIManager.m b/packages/react-native/React/Modules/RCTUIManager.m index 9fe11430c8b7f0..c6b73cc5bbbdf0 100644 --- a/packages/react-native/React/Modules/RCTUIManager.m +++ b/packages/react-native/React/Modules/RCTUIManager.m @@ -101,8 +101,11 @@ - (void)invalidate RCTExecuteOnMainQueue(^{ RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil); + NSMutableDictionary> *viewRegistry = + (NSMutableDictionary> *)self->_viewRegistry; for (NSNumber *rootViewTag in self->_rootViewTags) { - UIView *rootView = self->_viewRegistry[rootViewTag]; + id rootView = viewRegistry[rootViewTag]; + [self _purgeChildren:[rootView reactSubviews] fromRegistry:viewRegistry]; if ([rootView conformsToProtocol:@protocol(RCTInvalidating)]) { [(id)rootView invalidate]; }