react-native-navigation的迁移库

RNNBackButtonOptions.m 865B

12345678910111213141516171819202122232425262728293031
  1. #import "RNNBackButtonOptions.h"
  2. @implementation RNNBackButtonOptions
  3. - (void)applyOn:(UIViewController *)viewController {
  4. if (self.image) {
  5. UIImage *image = self.image ? [RCTConvert UIImage:self.image] : nil;
  6. [viewController.navigationController.navigationBar setBackIndicatorImage:image];
  7. [viewController.navigationController.navigationBar setBackIndicatorTransitionMaskImage:image];
  8. }
  9. if (self.visible) {
  10. viewController.navigationItem.hidesBackButton = ![self.visible boolValue];
  11. }
  12. if (self.showTitle && ![self.showTitle boolValue]) {
  13. self.title = @"";
  14. }
  15. if (self.title) {
  16. UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:self.title
  17. style:UIBarButtonItemStylePlain
  18. target:nil
  19. action:nil];
  20. viewController.navigationItem.backBarButtonItem = backItem;
  21. }
  22. }
  23. @end