react-native-navigation的迁移库

RNNNavigationStackManager.m 784B

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