react-native-navigation的迁移库

RNNNavigationController.m 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #import "RNNNavigationController.h"
  2. #import "RNNModalAnimation.h"
  3. @implementation RNNNavigationController
  4. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  5. return self.viewControllers.lastObject.supportedInterfaceOrientations;
  6. }
  7. - (UINavigationController *)navigationController {
  8. return self;
  9. }
  10. - (BOOL)isCustomViewController {
  11. return [self.getLeafViewController isCustomViewController];
  12. }
  13. - (void)mergeOptions:(RNNOptions *)options {
  14. [self.getLeafViewController mergeOptions:options];
  15. }
  16. - (UIStatusBarStyle)preferredStatusBarStyle {
  17. return self.getLeafViewController.preferredStatusBarStyle;
  18. }
  19. - (UIModalPresentationStyle)modalPresentationStyle {
  20. return self.getLeafViewController.modalPresentationStyle;
  21. }
  22. - (void)applyModalOptions {
  23. [self.getLeafViewController applyModalOptions];
  24. }
  25. - (UIViewController *)popViewControllerAnimated:(BOOL)animated {
  26. return [super popViewControllerAnimated:animated];
  27. }
  28. - (NSString *)componentId {
  29. return _componentId ? _componentId : self.getLeafViewController.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.getLeafViewController.options;
  39. }
  40. - (UIViewController *)getLeafViewController {
  41. return ((UIViewController<RNNRootViewProtocol>*)self.topViewController);
  42. }
  43. - (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
  44. [self.getLeafViewController waitForReactViewRender:wait perform:readyBlock];
  45. }
  46. - (UIViewController *)childViewControllerForStatusBarStyle {
  47. return self.topViewController;
  48. }
  49. @end