react-native-navigation的迁移库

RNNReactRootViewCreator.m 725B

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