react-native-navigation的迁移库

RNNNavigationStackManager.m 841B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #import "RNNNavigationStackManager.h"
  2. @interface RNNNavigationStackManager ()
  3. @property RNNStore *store;
  4. @end
  5. @implementation RNNNavigationStackManager
  6. -(instancetype)initWithStore:(RNNStore*)store {
  7. self = [super init];
  8. self.store = store;
  9. return self;
  10. }
  11. -(void)push:(UIViewController*)newTop onTop:(UIViewController*)currentTop animated:(BOOL)animated{
  12. [[currentTop navigationController] pushViewController:newTop animated:animated];
  13. }
  14. -(void)pop:(UIViewController*)vc animated:(BOOL)animated{
  15. if([[vc navigationController] topViewController] == vc ) {
  16. [[vc navigationController] popViewControllerAnimated:animated];
  17. }
  18. else {
  19. NSMutableArray * vcs = [vc navigationController].viewControllers.mutableCopy;
  20. [vcs removeObject:vc];
  21. [[vc navigationController] setViewControllers:vcs animated:animated];
  22. }
  23. }
  24. @end