react-native-navigation的迁移库

RNNStackController.m 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #import "RNNStackController.h"
  2. #import "RNNComponentViewController.h"
  3. @implementation RNNStackController
  4. -(void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions {
  5. [super setDefaultOptions:defaultOptions];
  6. [self.presenter setDefaultOptions:defaultOptions];
  7. }
  8. - (void)viewDidLayoutSubviews {
  9. [super viewDidLayoutSubviews];
  10. [self.presenter applyOptionsOnViewDidLayoutSubviews:self.resolveOptions];
  11. }
  12. - (UIViewController *)getCurrentChild {
  13. return self.topViewController;
  14. }
  15. - (UINavigationController *)navigationController {
  16. return self;
  17. }
  18. - (UIStatusBarStyle)preferredStatusBarStyle {
  19. return [_presenter getStatusBarStyle:self.resolveOptions];
  20. }
  21. - (UIModalPresentationStyle)modalPresentationStyle {
  22. return self.getCurrentChild.modalPresentationStyle;
  23. }
  24. - (UIViewController *)popViewControllerAnimated:(BOOL)animated {
  25. if (self.viewControllers.count > 1) {
  26. UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
  27. if ([controller isKindOfClass:[RNNComponentViewController class]]) {
  28. RNNComponentViewController *rnnController = (RNNComponentViewController *)controller;
  29. [self.presenter applyOptionsBeforePopping:rnnController.resolveOptions];
  30. }
  31. }
  32. return [super popViewControllerAnimated:animated];
  33. }
  34. - (UIViewController *)childViewControllerForStatusBarStyle {
  35. return self.topViewController;
  36. }
  37. @end