mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Changelog: [Internal] Fabric removes components bottom up (from leafs to the root). This means that by the time Fabric hides Modal, it has no content and therefore it appears as if Modal disappears without Animation. To fix this, we snapshot contents of the Modal before any of its contents are removed. Reviewed By: shergin Differential Revision: D23976244 fbshipit-source-id: 01c13b74e97f82816e8946fd9d1add1db10340b1
79 lines
1.9 KiB
Plaintext
79 lines
1.9 KiB
Plaintext
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTFabricModalHostViewController.h"
|
|
|
|
#import <React/RCTLog.h>
|
|
#import <React/RCTSurfaceTouchHandler.h>
|
|
|
|
@implementation RCTFabricModalHostViewController {
|
|
CGRect _lastViewBounds;
|
|
RCTSurfaceTouchHandler *_touchHandler;
|
|
}
|
|
|
|
- (instancetype)init
|
|
{
|
|
if (!(self = [super init])) {
|
|
return nil;
|
|
}
|
|
_touchHandler = [RCTSurfaceTouchHandler new];
|
|
|
|
return self;
|
|
}
|
|
|
|
- (void)viewDidLayoutSubviews
|
|
{
|
|
[super viewDidLayoutSubviews];
|
|
if (!CGRectEqualToRect(_lastViewBounds, self.view.bounds)) {
|
|
[_delegate boundsDidChange:self.view.bounds];
|
|
_lastViewBounds = self.view.bounds;
|
|
}
|
|
}
|
|
|
|
- (void)loadView
|
|
{
|
|
[super loadView];
|
|
[_touchHandler attachToView:self.view];
|
|
}
|
|
|
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
|
{
|
|
return [RCTSharedApplication() statusBarStyle];
|
|
}
|
|
|
|
- (void)viewDidDisappear:(BOOL)animated
|
|
{
|
|
[super viewDidDisappear:animated];
|
|
_lastViewBounds = CGRectZero;
|
|
}
|
|
|
|
- (BOOL)prefersStatusBarHidden
|
|
{
|
|
return [RCTSharedApplication() isStatusBarHidden];
|
|
}
|
|
|
|
#if RCT_DEV
|
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
|
{
|
|
UIInterfaceOrientationMask appSupportedOrientationsMask =
|
|
[RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]];
|
|
if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
|
|
RCTLogError(
|
|
@"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."
|
|
@"Add more interface orientations to your app's Info.plist to fix this."
|
|
@"NOTE: This will crash in non-dev mode.",
|
|
(unsigned)_supportedInterfaceOrientations,
|
|
(unsigned)appSupportedOrientationsMask);
|
|
return UIInterfaceOrientationMaskAll;
|
|
}
|
|
|
|
return _supportedInterfaceOrientations;
|
|
}
|
|
#endif // RCT_DEV
|
|
|
|
@end
|