Fix crash for unsupported device orientation events
Reviewed By: mmmulani Differential Revision: D5507716 fbshipit-source-id: 061a3060a5ea216028b1fbae81256d17db7f4b2f
This commit is contained in:
Родитель
6a4fb5edf2
Коммит
2444c54654
|
@ -206,7 +206,10 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
|||
degrees = @90;
|
||||
isLandscape = YES;
|
||||
break;
|
||||
default:
|
||||
case UIDeviceOrientationFaceDown:
|
||||
case UIDeviceOrientationFaceUp:
|
||||
case UIDeviceOrientationUnknown:
|
||||
// Unsupported
|
||||
return nil;
|
||||
}
|
||||
return @{
|
||||
|
@ -218,11 +221,15 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
|||
|
||||
- (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
|
||||
|
|
Загрузка…
Ссылка в новой задаче