react-native-navigation的迁移库

RNNRootViewController.m 926B

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