react-native-navigation的迁移库

RNNBottomTabOptions.m 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #import "RNNBottomTabOptions.h"
  2. #import "DotIndicatorOptions.h"
  3. #import "DotIndicatorParser.h"
  4. @implementation RNNBottomTabOptions
  5. - (instancetype)initWithDict:(NSDictionary *)dict {
  6. self = [super init];
  7. self.tag = arc4random();
  8. self.text = [TextParser parse:dict key:@"text"];
  9. self.badge = [TextParser parse:dict key:@"badge"];
  10. self.badgeColor = [ColorParser parse:dict key:@"badgeColor"];
  11. self.fontFamily = [TextParser parse:dict key:@"fontFamily"];
  12. self.fontWeight = [TextParser parse:dict key:@"fontWeight"];
  13. self.testID = [TextParser parse:dict key:@"testID"];
  14. self.dotIndicator = [DotIndicatorParser parse:dict];
  15. self.icon = [ImageParser parse:dict key:@"icon"];
  16. self.selectedIcon = [ImageParser parse:dict key:@"selectedIcon"];
  17. self.iconColor = [ColorParser parse:dict key:@"iconColor"];
  18. self.selectedIconColor = [ColorParser parse:dict key:@"selectedIconColor"];
  19. self.selectedTextColor = [ColorParser parse:dict key:@"selectedTextColor"];
  20. self.iconInsets = [DictionaryParser parse:dict key:@"iconInsets"];
  21. self.textColor = [ColorParser parse:dict key:@"textColor"];
  22. self.fontSize = [NumberParser parse:dict key:@"fontSize"];
  23. self.visible = [BoolParser parse:dict key:@"visible"];
  24. self.selectTabOnPress = [BoolParser parse:dict key:@"selectTabOnPress"];
  25. return self;
  26. }
  27. - (BOOL)hasValue {
  28. return
  29. self.text.hasValue ||
  30. self.badge.hasValue ||
  31. self.badgeColor.hasValue ||
  32. self.fontFamily.hasValue ||
  33. self.fontWeight.hasValue ||
  34. self.fontSize.hasValue ||
  35. self.testID.hasValue ||
  36. self.icon.hasValue ||
  37. self.selectedIcon.hasValue ||
  38. self.iconColor.hasValue ||
  39. self.selectedIconColor.hasValue ||
  40. self.selectedTextColor.hasValue ||
  41. self.iconInsets.hasValue ||
  42. self.textColor.hasValue ||
  43. self.visible.hasValue ||
  44. self.selectTabOnPress.hasValue;
  45. }
  46. @end