react-native-navigation的迁移库

RNNTopBarOptions.m 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #import "RNNTopBarOptions.h"
  2. #import "RNNNavigationButtons.h"
  3. #import "RNNCustomTitleView.h"
  4. #import "UIViewController+RNNOptions.h"
  5. #import "UINavigationController+RNNOptions.h"
  6. @interface RNNTopBarOptions ()
  7. @property (nonatomic, strong) RNNNavigationButtons* navigationButtons;
  8. @end
  9. @implementation RNNTopBarOptions
  10. - (instancetype)initWithDict:(NSDictionary *)dict {
  11. self = [super init];
  12. self.visible = [BoolParser parse:dict key:@"visible"];
  13. self.hideOnScroll = [BoolParser parse:dict key:@"hideOnScroll"];
  14. self.leftButtonColor = [ColorParser parse:dict key:@"leftButtonColor"];
  15. self.rightButtonColor = [ColorParser parse:dict key:@"rightButtonColor"];
  16. self.leftButtonDisabledColor = [ColorParser parse:dict key:@"leftButtonDisabledColor"];
  17. self.rightButtonDisabledColor = [ColorParser parse:dict key:@"rightButtonDisabledColor"];
  18. self.drawBehind = [BoolParser parse:dict key:@"drawBehind"];
  19. self.noBorder = [BoolParser parse:dict key:@"noBorder"];
  20. self.animate = [BoolParser parse:dict key:@"animate"];
  21. self.searchBar = [BoolParser parse:dict key:@"searchBar"];
  22. self.searchBarHiddenWhenScrolling = [BoolParser parse:dict key:@"searchBarHiddenWhenScrolling"];
  23. self.testID = [TextParser parse:dict key:@"testID"];
  24. self.barStyle = [TextParser parse:dict key:@"barStyle"];
  25. self.searchBarPlaceholder = [TextParser parse:dict key:@"searchBarPlaceholder"];
  26. self.largeTitle = [[RNNLargeTitleOptions alloc] initWithDict:dict[@"largeTitle"]];
  27. self.title = [[RNNTitleOptions alloc] initWithDict:dict[@"title"]];
  28. self.subtitle = [[RNNSubtitleOptions alloc] initWithDict:dict[@"subtitle"]];
  29. self.background = [[RNNBackgroundOptions alloc] initWithDict:dict[@"background"]];
  30. self.backButton = [[RNNBackButtonOptions alloc] initWithDict:dict[@"backButton"]];
  31. self.leftButtonStyle = [[RNNButtonOptions alloc] initWithDict:dict[@"leftButtonStyle"]];
  32. self.rightButtonStyle = [[RNNButtonOptions alloc] initWithDict:dict[@"rightButtonStyle"]];
  33. if (self.leftButtonColor.hasValue) {
  34. self.leftButtonStyle.color = self.leftButtonColor;
  35. }
  36. if (self.rightButtonColor.hasValue) {
  37. self.rightButtonStyle.color = self.rightButtonColor;
  38. }
  39. if (self.leftButtonDisabledColor.hasValue) {
  40. self.leftButtonStyle.disabledColor = self.rightButtonDisabledColor;
  41. }
  42. if (self.rightButtonDisabledColor.hasValue) {
  43. self.rightButtonStyle.disabledColor = self.rightButtonDisabledColor;
  44. }
  45. self.leftButtons = dict[@"leftButtons"];
  46. self.rightButtons = dict[@"rightButtons"];
  47. return self;
  48. }
  49. @end