12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- //
- // RNNViewController.m
- // ReactNativeNavigation
- //
- // Created by Ran Greenberg on 21/12/2016.
- // Copyright © 2016 artal. All rights reserved.
- //
-
- #import "RNNViewController.h"
- #import "RCTRootView.h"
-
- #define SCREEN @"screen"
- #define SIDE_MENU @"sideMenu"
- #define TABS @"tabs"
- #define SCREEN_KEY @"key"
-
-
- @interface RNNViewController ()
- @end
-
-
- @implementation RNNViewController
-
-
- #pragma mark - Static function
-
-
- + (UIViewController*)controllerWithLayout:(NSDictionary *)layout bridge:(RCTBridge *)bridge {
-
- UIViewController *controller = nil;
-
- NSDictionary *screen = layout[SCREEN];
- if (screen) {
- NSString *screenKey = screen[SCREEN_KEY];
- if (screenKey)
-
- controller = [RNNViewController navigationControllerWithScreenKey:screenKey bridge:bridge];
- }
-
- return controller;
-
- }
-
- +(UINavigationController*)navigationControllerWithScreenKey:(NSString*)screenKey bridge:(RCTBridge*)bridge {
-
- UINavigationController *controller = nil;
-
- UIViewController *viewController = [UIViewController new];
- RCTRootView *reactView = [[RCTRootView alloc] initWithBridge:bridge moduleName:SCREEN_KEY initialProperties:nil];
- controller = [[UINavigationController alloc] initWithRootViewController:viewController];
-
- return controller;
- }
-
-
- @end
-
|