react-native-navigation的迁移库

RNNScreenTransition.m 1016B

12345678910111213141516171819202122232425262728293031323334353637
  1. #import "RNNScreenTransition.h"
  2. @implementation RNNScreenTransition
  3. - (instancetype)initWithDict:(NSDictionary *)dict {
  4. self = [super init];
  5. self.topBar = [[RNNElementTransitionOptions alloc] initWithDict:dict[@"topBar"]];
  6. self.content = [[RNNElementTransitionOptions alloc] initWithDict:dict[@"content"]];
  7. self.bottomTabs = [[RNNElementTransitionOptions alloc] initWithDict:dict[@"bottomTabs"]];
  8. self.enable = [BoolParser parse:dict key:@"enabled"];
  9. self.waitForRender = [BoolParser parse:dict key:@"waitForRender"];
  10. return self;
  11. }
  12. - (BOOL)hasCustomAnimation {
  13. return (self.topBar.hasAnimation || self.content.hasAnimation || self.bottomTabs.hasAnimation);
  14. }
  15. - (double)maxDuration {
  16. double maxDuration = 0;
  17. if ([self.topBar maxDuration] > 0) {
  18. maxDuration = [self.topBar maxDuration];
  19. }
  20. if ([self.content maxDuration] > 0) {
  21. maxDuration = [self.content maxDuration];
  22. }
  23. if ([self.bottomTabs maxDuration] > 0) {
  24. maxDuration = [self.bottomTabs maxDuration];
  25. }
  26. return maxDuration;
  27. }
  28. @end