react-native-navigation的迁移库

RNNReactRootViewCreator.m 625B

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