react-native-navigation的迁移库

RNNTransitionStateHolder.m 1.6KB

123456789101112131415161718192021222324252627282930313233
  1. #import "RNNTransitionStateHolder.h"
  2. #import "RNNUtils.h"
  3. #import "RNNElementFinder.h"
  4. @implementation RNNTransitionStateHolder
  5. -(instancetype)initWithTransition:(NSDictionary *)transition {
  6. self = [super init];
  7. self.springDamping = [RNNUtils getDoubleOrKey:transition withKey:@"springDamping" withDefault:0.85];
  8. self.springVelocity = [RNNUtils getDoubleOrKey:transition withKey:@"springVelocity" withDefault:0.8];
  9. self.startDelay = [RNNUtils getDoubleOrKey:transition withKey:@"startDelay" withDefault:0];
  10. self.duration = [RNNUtils getDoubleOrKey:transition withKey:@"duration" withDefault:1];
  11. self.startAlpha = [RNNUtils getDoubleOrKey:transition withKey:@"startAlpha" withDefault:1];
  12. self.endAlpha = [RNNUtils getDoubleOrKey:transition withKey:@"endAlpha" withDefault:1];
  13. self.interactivePop = [RNNUtils getBoolOrKey:transition withKey:@"interactivePop" withDefault:NO];
  14. self.startX = [RNNUtils getDoubleOrKey:transition[@"x"] withKey:@"from" withDefault:0];
  15. self.startY = [RNNUtils getDoubleOrKey:transition[@"y"] withKey:@"from" withDefault:0];
  16. self.endX = [RNNUtils getDoubleOrKey:transition[@"x"] withKey:@"to" withDefault:0];
  17. self.endY = [RNNUtils getDoubleOrKey:transition[@"y"] withKey:@"to" withDefault:0];
  18. self.fromId = [transition objectForKey:@"fromId"];
  19. self.toId = [transition objectForKey:@"toId"];
  20. self.fromElement = nil;
  21. self.fromElementType = nil;
  22. self.fromElementResizeMode = UIViewContentModeScaleAspectFill;
  23. self.toElement = nil;
  24. self.animatedView = nil;
  25. self.locations = nil;
  26. self.isSharedElementTransition = [[transition objectForKey:@"type"] isEqualToString:@"sharedElement"];
  27. return self;
  28. }
  29. @end