react-native-navigation的迁移库

RNNNavigationController.m 1.8KB

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