react-native-navigation的迁移库

RNNReactRootViewCreator.m 712B

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