react-native-navigation的迁移库

RNNRootViewController.m 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #import "RNNRootViewController.h"
  2. @interface RNNRootViewController()
  3. @property NSString* containerId;
  4. @property NSString* containerName;
  5. @property RNNEventEmitter *eventEmitter;
  6. @end
  7. @implementation RNNRootViewController
  8. -(instancetype)initWithNode:(RNNLayoutNode*)node rootViewCreator:(id<RNNRootViewCreator>)creator eventEmitter:(RNNEventEmitter*)eventEmitter {
  9. self = [super init];
  10. self.containerId = node.nodeId;
  11. self.containerName = node.data[@"name"];
  12. self.eventEmitter = eventEmitter;
  13. self.view = [creator createRootView:self.containerName rootViewId:self.containerId];
  14. // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJsReload) name:RCTJavaScriptWillStartLoadingNotification object:nil];
  15. return self;
  16. }
  17. -(void)viewDidAppear:(BOOL)animated {
  18. [super viewDidAppear:animated];
  19. [self.eventEmitter sendContainerStart:self.containerId];
  20. }
  21. -(void)viewDidDisappear:(BOOL)animated {
  22. [super viewDidDisappear:animated];
  23. [self.eventEmitter sendContainerStop:self.containerId];
  24. }
  25. ///**
  26. // * fix for
  27. // */
  28. //-(void)onJsReload {
  29. // [[NSNotificationCenter defaultCenter] removeObserver:self];
  30. // [[NSNotificationCenter defaultCenter] removeObserver:self.view];
  31. // self.view = nil;
  32. //}
  33. -(void)dealloc {
  34. }
  35. @end