react-native-navigation的迁移库

RNNReactRootViewCreator.m 609B

123456789101112131415161718192021222324252627282930
  1. #import "RNNReactRootViewCreator.h"
  2. #import <React/RCTRootView.h>
  3. @implementation RNNReactRootViewCreator {
  4. RCTBridge *_bridge;
  5. }
  6. -(instancetype)initWithBridge:(RCTBridge*)bridge {
  7. self = [super init];
  8. _bridge = bridge;
  9. return self;
  10. }
  11. - (UIView*)createRootView:(NSString*)name rootViewId:(NSString*)rootViewId {
  12. if (!rootViewId) {
  13. @throw [NSException exceptionWithName:@"MissingViewId" reason:@"Missing view id" userInfo:nil];
  14. }
  15. UIView *view = [[RCTRootView alloc] initWithBridge:_bridge
  16. moduleName:name
  17. initialProperties:@{@"id": rootViewId}];
  18. return view;
  19. }
  20. @end