react-native-navigation的迁移库

RNNReactRootViewCreator.m 683B

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