1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #import "RNNLayoutOptions.h"
- #import <React/RCTConvert.h>
-
- @implementation RNNLayoutOptions
-
- - (void)applyOn:(UIViewController *)viewController {
- if (self.screenBackgroundColor) {
- UIColor* screenColor = [RCTConvert UIColor:self.screenBackgroundColor];
- viewController.view.backgroundColor = screenColor;
- }
- }
-
- - (UIInterfaceOrientationMask)supportedOrientations {
- NSArray* orientationsArray = [self.orientation isKindOfClass:[NSString class]] ? @[self.orientation] : self.orientation;
- NSUInteger supportedOrientationsMask = 0;
- if (!orientationsArray || [self.orientation isEqual:@"default"]) {
- return [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
- } else {
- for (NSString* orientation in orientationsArray) {
- if ([orientation isEqualToString:@"all"]) {
- supportedOrientationsMask = UIInterfaceOrientationMaskAll;
- break;
- }
- if ([orientation isEqualToString:@"landscape"]) {
- supportedOrientationsMask = (supportedOrientationsMask | UIInterfaceOrientationMaskLandscape);
- }
- if ([orientation isEqualToString:@"portrait"]) {
- supportedOrientationsMask = (supportedOrientationsMask | UIInterfaceOrientationMaskPortrait);
- }
- if ([orientation isEqualToString:@"upsideDown"]) {
- supportedOrientationsMask = (supportedOrientationsMask | UIInterfaceOrientationMaskPortraitUpsideDown);
- }
- }
- }
-
- return supportedOrientationsMask;
- }
-
-
- @end
|