Skip to content

Commit 47b36d3

Browse files
mrtnrstfacebook-github-bot
authored andcommittedFeb 12, 2018
Update DevLoadingView to Support iPhone X
Summary: The current implementation of DevLoadingView for iPhone currently gives a static height of `22` and does not take into account iPhoneX screen dimensions. Devices: All iPhone devices currently available with Xcode v9.2 SDK: 8.1, 9, 10, 11 Validate resize only occurs on iPhone X devices and others remain consistent. Before: ![feb-10-2018 12-30-20](https://user-images.githubusercontent.com/1743953/36065313-7b41f2ea-0e5e-11e8-87f2-928e26536077.gif) After: ![feb-10-2018 12-28-15](https://user-images.githubusercontent.com/1743953/36065317-848e4f7e-0e5e-11e8-8aab-70cb5db32f31.gif) [GENERAL][ENHANCEMENT][{React}] - Improvements to DevLoadingView for iPhone X Closes #17936 Differential Revision: D6962962 Pulled By: shergin fbshipit-source-id: e11d9386544fe19a9195e22a03e12f64e934cad7
1 parent 9d21496 commit 47b36d3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
 

‎React/DevSupport/RCTDevLoadingView.m

+9-5
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,15 @@ - (void)setBridge:(RCTBridge *)bridge
7373
dispatch_async(dispatch_get_main_queue(), ^{
7474
self->_showDate = [NSDate date];
7575
if (!self->_window && !RCTRunningInTestEnvironment()) {
76-
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
77-
self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 22)];
76+
CGSize screenSize = [UIScreen mainScreen].bounds.size;
77+
if (screenSize.height == 812 /* iPhone X */) {
78+
self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, 60)];
79+
self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, self->_window.bounds.size.width, 30)];
80+
} else {
81+
self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, 22)];
82+
self->_label = [[UILabel alloc] initWithFrame:self->_window.bounds];
83+
}
84+
[self->_window addSubview:self->_label];
7885
#if TARGET_OS_TV
7986
self->_window.windowLevel = UIWindowLevelNormal + 1;
8087
#else
@@ -83,11 +90,8 @@ - (void)setBridge:(RCTBridge *)bridge
8390
// set a root VC so rotation is supported
8491
self->_window.rootViewController = [UIViewController new];
8592

86-
self->_label = [[UILabel alloc] initWithFrame:self->_window.bounds];
8793
self->_label.font = [UIFont systemFontOfSize:12.0];
8894
self->_label.textAlignment = NSTextAlignmentCenter;
89-
90-
[self->_window addSubview:self->_label];
9195
}
9296

9397
self->_label.text = message;

0 commit comments

Comments
 (0)