Permalink
Browse files

Fix crash for unsupported device orientation events

Reviewed By: mmmulani

Differential Revision: D5507716

fbshipit-source-id: 061a3060a5ea216028b1fbae81256d17db7f4b2f
  • Loading branch information...
javache authored and facebook-github-bot committed Jul 28, 2017
1 parent 6a4fb5e commit 2444c54654807eb5a42d0cf67fe86a69fbb5a8a1
Showing with 10 additions and 3 deletions.
  1. +10 −3 React/Modules/RCTUIManager.m
@@ -206,7 +206,10 @@ - (void)didReceiveNewContentSizeMultiplier
degrees = @90;
isLandscape = YES;
break;
default:
case UIDeviceOrientationFaceDown:
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationUnknown:
// Unsupported
return nil;
}
return @{
@@ -218,11 +221,15 @@ - (void)didReceiveNewContentSizeMultiplier
- (void)namedOrientationDidChange
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
NSDictionary *orientationEvent = deviceOrientationEventBody([UIDevice currentDevice].orientation);
if (!orientationEvent) {
return;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_bridge.eventDispatcher sendDeviceEventWithName:@"namedOrientationDidChange"
body:deviceOrientationEventBody(deviceOrientation)];
body:orientationEvent];
#pragma clang diagnostic pop
}
#endif

0 comments on commit 2444c54

Please sign in to comment.