react-native-navigation的迁移库

RNNNavigationController.m 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #import "RNNNavigationController.h"
  2. #import "RNNModalAnimation.h"
  3. @implementation RNNNavigationController
  4. - (instancetype)initWithOptions:(RNNNavigationOptions *)options {
  5. self = [super init];
  6. if (self) {
  7. _options = options;
  8. }
  9. return self;
  10. }
  11. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  12. return self.viewControllers.lastObject.supportedInterfaceOrientations;
  13. }
  14. - (UINavigationController *)navigationController {
  15. return self;
  16. }
  17. - (UIStatusBarStyle)preferredStatusBarStyle {
  18. return self.getLeafViewController.preferredStatusBarStyle;
  19. }
  20. - (UIModalPresentationStyle)modalPresentationStyle {
  21. return self.getLeafViewController.modalPresentationStyle;
  22. }
  23. - (UIViewController *)popViewControllerAnimated:(BOOL)animated {
  24. return [super popViewControllerAnimated:animated];
  25. }
  26. - (NSString *)componentId {
  27. return _componentId ? _componentId : self.getLeafViewController.componentId;
  28. }
  29. - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
  30. return [[RNNModalAnimation alloc] initWithScreenTransition:self.getLeafViewController.options.animations.showModal isDismiss:NO];
  31. }
  32. - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
  33. return [[RNNModalAnimation alloc] initWithScreenTransition:self.getLeafViewController.options.animations.dismissModal isDismiss:YES];
  34. }
  35. - (UIViewController *)getLeafViewController {
  36. return ((UIViewController<RNNRootViewProtocol>*)self.topViewController);
  37. }
  38. - (UIViewController *)childViewControllerForStatusBarStyle {
  39. return self.topViewController;
  40. }
  41. - (void)applyTabBarItem {
  42. [self.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.options.defaultOptions).bottomTab overrideOptions:NO];
  43. [self.options.bottomTab applyOn:self];
  44. [self.getLeafViewController.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.getLeafViewController.options.defaultOptions).bottomTab overrideOptions:NO];
  45. [self.getLeafViewController.options.bottomTab applyOn:self];
  46. }
  47. @end