react-native-navigation的迁移库

RNNNavigationOptions.m 764B

12345678910111213141516171819202122232425262728293031
  1. #import "RNNNavigationOptions.h"
  2. #import <React/RCTConvert.h>
  3. @implementation RNNNavigationOptions
  4. -(instancetype)initWithDict:(NSDictionary *)navigationOptions {
  5. self = [super init];
  6. self.topBarBackgroundColor = [navigationOptions objectForKey:@"topBarBackgroundColor"];
  7. self.statusBarHidden = [navigationOptions objectForKey:@"statusBarHidden"];
  8. self.title = [navigationOptions objectForKey:@"title"];
  9. return self;
  10. }
  11. -(void)apply:(UIViewController*)viewController{
  12. if (self.topBarBackgroundColor) {
  13. UIColor* backgroundColor = [RCTConvert UIColor:self.topBarBackgroundColor];
  14. viewController.navigationController.navigationBar.barTintColor = backgroundColor;
  15. }
  16. if (self.title) {
  17. viewController.navigationItem.title = self.title;
  18. }
  19. }
  20. @end