react-native-navigation的迁移库

RNNReactRootViewCreator.m 804B

12345678910111213141516171819202122232425262728293031323334
  1. #import "RNNReactRootViewCreator.h"
  2. #import "RNNReactRootView.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 = [[RNNReactRootView alloc] initWithBridge:_bridge
  16. moduleName:name
  17. initialProperties:@{@"componentId": rootViewId}];
  18. return view;
  19. }
  20. -(UIView*)createRootViewFromComponentOptions:(RNNComponentOptions*)componentOptions {
  21. return [self createRootView:componentOptions.name rootViewId:componentOptions.componentId];
  22. }
  23. @end