react-native-navigation的迁移库

RNNRootViewController.m 909B

123456789101112131415161718192021222324252627282930313233343536
  1. #import "RNNRootViewController.h"
  2. #import <React/RCTRootView.h>
  3. @interface RNNRootViewController()
  4. @property NSString* containerId;
  5. @property NSString* containerName;
  6. @property RNNEventEmitter *eventEmitter;
  7. @end
  8. @implementation RNNRootViewController
  9. -(instancetype)initWithNode:(RNNLayoutNode*)node rootViewCreator:(id<RNNRootViewCreator>)creator eventEmitter:(RNNEventEmitter*)eventEmitter {
  10. self = [super init];
  11. self.containerId = node.nodeId;
  12. self.containerName = node.data[@"name"];
  13. self.eventEmitter = eventEmitter;
  14. self.view = [creator createRootView:self.containerName rootViewId:self.containerId];
  15. return self;
  16. }
  17. -(void)viewDidAppear:(BOOL)animated
  18. {
  19. [super viewDidAppear:animated];
  20. [self.eventEmitter sendContainerStart:self.containerId];
  21. }
  22. -(void)viewDidDisappear:(BOOL)animated
  23. {
  24. [super viewDidDisappear:animated];
  25. [self.eventEmitter sendContainerStop:self.containerId];
  26. }
  27. @end