react-native-navigation的迁移库

RNNElementTransitionOptions.m 957B

1234567891011121314151617181920212223242526272829303132333435
  1. #import "RNNElementTransitionOptions.h"
  2. @implementation RNNElementTransitionOptions
  3. - (instancetype)initWithDict:(NSDictionary *)dict {
  4. self = [super init];
  5. self.alpha = [[RNNAnimationConfigurationOptions alloc] initWithDict:dict[@"alpha"]];
  6. self.x = [[RNNAnimationConfigurationOptions alloc] initWithDict:dict[@"x"]];
  7. self.y = [[RNNAnimationConfigurationOptions alloc] initWithDict:dict[@"y"]];
  8. return self;
  9. }
  10. - (BOOL)hasAnimation {
  11. return self.x.hasAnimation || self.y.hasAnimation || self.alpha.hasAnimation;
  12. }
  13. - (double)maxDuration {
  14. double maxDuration = 0;
  15. if ([_x.duration getWithDefaultValue:0] > maxDuration) {
  16. maxDuration = [_x.duration getWithDefaultValue:0];
  17. }
  18. if ([_y.duration getWithDefaultValue:0] > maxDuration) {
  19. maxDuration = [_y.duration getWithDefaultValue:0];
  20. }
  21. if ([_alpha.duration getWithDefaultValue:0] > maxDuration) {
  22. maxDuration = [_alpha.duration getWithDefaultValue:0];
  23. }
  24. return maxDuration;
  25. }
  26. @end