diff --git a/packages/react-native/React/Base/RCTRootView.h b/packages/react-native/React/Base/RCTRootView.h index 32eeb7ab007dcb..6ed9c5b8fc48f2 100644 --- a/packages/react-native/React/Base/RCTRootView.h +++ b/packages/react-native/React/Base/RCTRootView.h @@ -133,6 +133,11 @@ extern */ @property (nonatomic, weak, nullable) UIViewController *reactViewController; +/** + * The root view casted as UIView. Used by splash screen libraries. + */ +@property (nonatomic, strong, readonly) UIView *view; + /** * The React-managed contents view of the root view. */ diff --git a/packages/react-native/React/Base/RCTRootView.m b/packages/react-native/React/Base/RCTRootView.m index 5cb98b5ce9794d..a7b9b22881543f 100644 --- a/packages/react-native/React/Base/RCTRootView.m +++ b/packages/react-native/React/Base/RCTRootView.m @@ -116,6 +116,11 @@ - (instancetype)initWithBundleURL:(NSURL *)bundleURL RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) +- (UIView *)view +{ + return self; +} + - (BOOL)hasBridge { return _bridge != nil; diff --git a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h index 3b2f7911464015..bb5a574e2ee1f5 100644 --- a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +++ b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h @@ -34,6 +34,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility; @property (nonatomic, weak) id delegate; @property (nonatomic, weak) UIViewController *reactViewController; +@property (nonatomic, strong, readonly) UIView *view; @property (nonatomic, strong, readonly) UIView *contentView; @property (nonatomic, strong) UIView *loadingView; @property (nonatomic, assign) BOOL passThroughTouches; diff --git a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm index 8f48551167f398..91ead4e7492774 100644 --- a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +++ b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm @@ -134,6 +134,11 @@ - (NSString *)moduleName return super.surface.moduleName; } +- (UIView *)view +{ + return (UIView *)super.surface.view; +} + - (UIView *)contentView { return self;