react-native-navigation的迁移库

RNNTransitionStateHolder.m 1.4KB

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