react-native-navigation的迁移库

RNNPushAnimation.m 1.6KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #import "RNNPushAnimation.h"
  2. @implementation RNNPushAnimation
  3. - (instancetype)initWithScreenTransition:(RNNScreenTransition *)screenTransition {
  4. self = [super init];
  5. self.screenTransition = screenTransition;
  6. return self;
  7. }
  8. - (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
  9. return self.screenTransition.content.duration;
  10. }
  11. - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
  12. UIViewController* toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
  13. [[transitionContext containerView] addSubview:toViewController.view];
  14. [self.screenTransition.content setupInitialTransitionForView:toViewController.view];
  15. [self.screenTransition.topBar setupInitialTransitionForView:toViewController.navigationController.navigationBar];
  16. [self.screenTransition.bottomTabs setupInitialTransitionForView:toViewController.tabBarController.tabBar];
  17. [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:self.screenTransition.content.startDelay options:self.screenTransition.content.interpolation animations:^{
  18. [self.screenTransition.content completeTransitionForView:toViewController.view];
  19. [self.screenTransition.topBar completeTransitionForView:toViewController.navigationController.navigationBar];
  20. [self.screenTransition.bottomTabs completeTransitionForView:toViewController.tabBarController.tabBar];
  21. } completion:^(BOOL finished) {
  22. [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
  23. }];
  24. }
  25. @end