react-native-navigation的迁移库

RNNUIBarButtonItem.m 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. #import <Foundation/Foundation.h>
  2. #import <UIKit/UIKit.h>
  3. #import "RNNUIBarButtonItem.h"
  4. @implementation RNNUIBarButtonItem
  5. -(instancetype)init:(NSString*)buttonId withIcon:(UIImage*)iconImage {
  6. self = [super initWithImage:iconImage style:UIBarButtonItemStylePlain target:nil action:nil];
  7. self.buttonId = buttonId;
  8. return self;
  9. }
  10. -(instancetype)init:(NSString*)buttonId withTitle:(NSString*)title {
  11. self = [super initWithTitle:title style:UIBarButtonItemStylePlain target:nil action:nil];
  12. self.buttonId = buttonId;
  13. return self;
  14. }
  15. -(instancetype)init:(NSString*)buttonId withCustomView:(RCTRootView *)reactView {
  16. self = [super initWithCustomView:reactView];
  17. reactView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
  18. reactView.delegate = self;
  19. reactView.backgroundColor = [UIColor clearColor];
  20. self.buttonId = buttonId;
  21. return self;
  22. }
  23. - (void)rootViewDidChangeIntrinsicSize:(RCTRootView *)rootView {
  24. CGSize size = rootView.intrinsicContentSize;
  25. rootView.frame = CGRectMake(0, 0, size.width, size.height);
  26. self.width = size.width;
  27. }
  28. @end