react-native-navigation的迁移库

RCCToolBar.m 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // RCCToolBar.m
  3. // ReactNativeControllers
  4. //
  5. // Created by Ran Greenberg on 09/05/2016.
  6. // Copyright © 2016 artal. All rights reserved.
  7. //
  8. #import "RCCToolBar.h"
  9. @interface RCCToolBarView : UIView
  10. @property (nonatomic) BOOL toolBarTranslucent;
  11. @property (nonatomic, strong) UIToolbar *toolbar;
  12. @end
  13. @implementation RCCToolBarView
  14. -(instancetype)init
  15. {
  16. self = [super init];
  17. if (self)
  18. {
  19. self.toolBarTranslucent = self.toolbar.translucent;
  20. self.backgroundColor = [UIColor clearColor];
  21. self.toolbar = [[UIToolbar alloc] init];
  22. [self addSubview:self.toolbar];
  23. }
  24. return self;
  25. }
  26. -(void)didMoveToWindow
  27. {
  28. [super didMoveToWindow];
  29. self.toolbar.translucent = self.toolBarTranslucent;
  30. }
  31. -(void)reactSetFrame:(CGRect)frame {
  32. [super reactSetFrame:frame];
  33. self.toolbar.frame = self.bounds;
  34. }
  35. @end
  36. @implementation RCCToolBar
  37. RCT_EXPORT_MODULE()
  38. - (UIView *)view
  39. {
  40. return [[RCCToolBarView alloc] init];
  41. }
  42. RCT_CUSTOM_VIEW_PROPERTY(translucent, BOOL, RCCToolBarView)
  43. {
  44. view.toolBarTranslucent = [RCTConvert BOOL:json];
  45. }
  46. @end