react-native-navigation的迁移库

RNNSharedElementAnimationOptions.m 807B

12345678910111213141516171819202122232425262728293031323334353637
  1. #import "RNNSharedElementAnimationOptions.h"
  2. #define DEFAULT_DURATION @(0.7)
  3. #define DEFAULT_SPRING_VELOCITY @(0.8)
  4. #define DEFAULT_SPRING_DAMPING @(0.85)
  5. @implementation RNNSharedElementAnimationOptions
  6. - (instancetype)initWithDict:(NSDictionary *)dict {
  7. self = [super init];
  8. self.animations = dict[@"animations"];
  9. self.duration = dict[@"duration"];
  10. self.springDamping = dict[@"springDamping"];
  11. self.springVelocity = dict[@"springVelocity"];
  12. return self;
  13. }
  14. - (NSNumber *)duration {
  15. return _duration ? _duration : DEFAULT_DURATION;
  16. }
  17. - (NSNumber *)springVelocity {
  18. return _springVelocity ? _springVelocity : DEFAULT_SPRING_VELOCITY;
  19. }
  20. - (NSNumber *)springDamping {
  21. return _springDamping ? _springDamping : DEFAULT_SPRING_DAMPING;
  22. }
  23. - (BOOL)hasValue {
  24. return self.animations;
  25. }
  26. @end