react-native-navigation的迁移库

StackTransitionDelegate.m 1.4KB

12345678910111213141516171819202122232425262728293031
  1. #import "StackTransitionDelegate.h"
  2. #import "SharedElementTransitionsCreator.h"
  3. #import "ElementTransitionsCreator.h"
  4. #import "ContentTransitionCreator.h"
  5. @implementation StackTransitionDelegate {
  6. RNNScreenTransition* _screenTransition;
  7. }
  8. - (instancetype)initWithScreenTransition:(RNNScreenTransition *)screenTransition uiManager:(RCTUIManager *)uiManager {
  9. self = [super initWithUIManager:uiManager];
  10. _screenTransition = screenTransition;
  11. return self;
  12. }
  13. - (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
  14. return _screenTransition.maxDuration;
  15. }
  16. - (NSArray *)createTransitionsFromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC containerView:(UIView *)containerView {
  17. ContentTransitionCreator* contentTransition = [ContentTransitionCreator createTransition:_screenTransition.content view:toVC.view fromVC:fromVC toVC:toVC containerView:containerView];
  18. NSArray* elementTransitions = [ElementTransitionsCreator create:_screenTransition.elementTransitions fromVC:fromVC toVC:toVC containerView:containerView];
  19. NSArray* sharedElementTransitions = [SharedElementTransitionsCreator create:_screenTransition.sharedElementTransitions fromVC:fromVC toVC:toVC containerView:containerView];
  20. return [[[NSArray arrayWithObject:contentTransition] arrayByAddingObjectsFromArray:elementTransitions] arrayByAddingObjectsFromArray:sharedElementTransitions];
  21. }
  22. @end