react-native-navigation的迁移库

RNNControllerFactory.m 870B

1234567891011121314151617181920212223242526272829
  1. #import "RNNControllerFactory.h"
  2. #import "RNN.h"
  3. #import "RCTRootView.h"
  4. @implementation RNNControllerFactory
  5. +(UIViewController *)createRootViewController:(NSDictionary *)layout
  6. {
  7. NSString* containerName = layout[@"container"][@"name"];
  8. NSString* containerId = layout[@"container"][@"id"];
  9. return [RNNControllerFactory create:containerName containerId:containerId];
  10. }
  11. +(UIViewController*)create:(NSString*)containerName containerId:(NSString*)containerId
  12. {
  13. RCTRootView *reactView = [[RCTRootView alloc] initWithBridge:RNN.instance.bridge
  14. moduleName:containerName
  15. initialProperties:@{@"containerId": containerId}];
  16. UIViewController* controller = [UIViewController new];
  17. controller.view = reactView;
  18. return controller;
  19. }
  20. @end