Ensure LogBox uses UIWindowScene API for opening its view
Summary: Changelog: [iOS][Internal] Fix: Ensure LogBox uses UIWindowScene API for multi-window Mac Catalyst Apps Reviewed By: arhelmus Differential Revision: D35825513 fbshipit-source-id: 3dc5db7c84d2abf7cf4a3ffb3512de723a32f72d
This commit is contained in:
Родитель
c6dc01fac6
Коммит
6855f7405c
|
@ -55,12 +55,12 @@ RCT_EXPORT_METHOD(show)
|
|||
}
|
||||
|
||||
if (strongSelf->_bridgelessSurfacePresenter) {
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:RCTKeyWindow().frame
|
||||
surfacePresenter:strongSelf->_bridgelessSurfacePresenter];
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow()
|
||||
surfacePresenter:strongSelf->_bridgelessSurfacePresenter];
|
||||
} else if (strongSelf->_bridge && strongSelf->_bridge.valid) {
|
||||
if (strongSelf->_bridge.surfacePresenter) {
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:RCTKeyWindow().frame
|
||||
surfacePresenter:strongSelf->_bridge.surfacePresenter];
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow()
|
||||
surfacePresenter:strongSelf->_bridge.surfacePresenter];
|
||||
} else {
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow() bridge:strongSelf->_bridge];
|
||||
}
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
|
||||
- (void)createRootViewController:(UIView *)view;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter;
|
||||
|
||||
- (instancetype)initWithWindow:(UIWindow *)window bridge:(RCTBridge *)bridge;
|
||||
- (instancetype)initWithWindow:(UIWindow *)window surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter;
|
||||
|
||||
- (void)show;
|
||||
|
||||
|
|
|
@ -33,21 +33,6 @@
|
|||
self.rootViewController = _rootViewController;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
id<RCTSurfaceProtocol> surface = [surfacePresenter createFabricSurfaceForModuleName:@"LogBox"
|
||||
initialProperties:@{}];
|
||||
[surface start];
|
||||
RCTSurfaceHostingView *rootView = [[RCTSurfaceHostingView alloc]
|
||||
initWithSurface:surface
|
||||
sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];
|
||||
|
||||
[self createRootViewController:rootView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithWindow:(UIWindow *)window bridge:(RCTBridge *)bridge
|
||||
{
|
||||
RCTErrorNewArchitectureValidation(RCTNotAllowedInAppWideFabric, @"RCTLogBoxView", nil);
|
||||
|
@ -72,6 +57,24 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithWindow:(UIWindow *)window surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
|
||||
{
|
||||
if (@available(iOS 13.0, *)) {
|
||||
self = [super initWithWindowScene:window.windowScene];
|
||||
} else {
|
||||
self = [super initWithFrame:window.frame];
|
||||
}
|
||||
|
||||
id<RCTSurfaceProtocol> surface = [surfacePresenter createFabricSurfaceForModuleName:@"LogBox" initialProperties:@{}];
|
||||
[surface start];
|
||||
RCTSurfaceHostingView *rootView = [[RCTSurfaceHostingView alloc]
|
||||
initWithSurface:surface
|
||||
sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];
|
||||
[self createRootViewController:rootView];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
|
Загрузка…
Ссылка в новой задаче