File tree 4 files changed +36
-1
lines changed
4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 8
8
*/
9
9
10
10
#import < UIKit/UIKit.h>
11
-
11
+ # import " RCTWrapperViewController.h "
12
12
#import " RCTComponent.h"
13
13
14
14
@interface RCTNavItem : UIView
15
15
16
16
@property (nonatomic , copy ) NSString *title;
17
+ @property (nonatomic , weak ) RCTWrapperViewController *delegate;
17
18
@property (nonatomic , strong ) UIImage *leftButtonIcon;
18
19
@property (nonatomic , copy ) NSString *leftButtonTitle;
19
20
@property (nonatomic , strong ) UIImage *rightButtonIcon;
Original file line number Diff line number Diff line change 11
11
12
12
@implementation RCTNavItem
13
13
14
+ @synthesize delegate = _delegate;
14
15
@synthesize backButtonItem = _backButtonItem;
15
16
@synthesize leftButtonItem = _leftButtonItem;
16
17
@synthesize rightButtonItem = _rightButtonItem;
17
18
19
+ - (void )setTitle : (NSString *)title
20
+ {
21
+ if (title != _title) {
22
+ _title = title;
23
+ [self .delegate titleDidChange: title];
24
+ }
25
+ }
26
+
27
+ - (void )setBarTintColor : (UIColor *)barTintColor
28
+ {
29
+ if (barTintColor != _barTintColor) {
30
+ _barTintColor = barTintColor;
31
+ [self .delegate barTintColorDidChange: barTintColor];
32
+ }
33
+ }
34
+
18
35
- (void )setBackButtonTitle : (NSString *)backButtonTitle
19
36
{
20
37
_backButtonTitle = backButtonTitle;
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ didMoveToNavigationController:(UINavigationController *)navigationController;
26
26
- (instancetype )initWithContentView : (UIView *)contentView NS_DESIGNATED_INITIALIZER;
27
27
- (instancetype )initWithNavItem : (RCTNavItem *)navItem ;
28
28
29
+ - (void )titleDidChange : (NSString *)title ;
30
+ - (void )barTintColorDidChange : (UIColor *)barTintColor ;
31
+
29
32
@property (nonatomic , weak ) id <RCTWrapperViewControllerNavigationListener> navigationListener;
30
33
@property (nonatomic , strong ) RCTNavItem *navItem;
31
34
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ - (instancetype)initWithNavItem:(RCTNavItem *)navItem
45
45
{
46
46
if ((self = [self initWithContentView: navItem])) {
47
47
_navItem = navItem;
48
+ _navItem.delegate = self;
48
49
}
49
50
return self;
50
51
}
@@ -60,6 +61,19 @@ - (void)viewWillLayoutSubviews
60
61
_currentBottomLayoutGuide = self.bottomLayoutGuide ;
61
62
}
62
63
64
+
65
+ - (void )titleDidChange : (NSString *)title
66
+ {
67
+ UINavigationItem *item = self.navigationItem ;
68
+ item.title = title;
69
+ }
70
+
71
+ - (void )barTintColorDidChange : (UIColor *)barTintColor
72
+ {
73
+ UINavigationBar *bar = self.navigationController .navigationBar ;
74
+ bar.barTintColor = barTintColor;
75
+ }
76
+
63
77
static BOOL RCTFindScrollViewAndRefreshContentInsetInView (UIView *view)
64
78
{
65
79
if ([view conformsToProtocol: @protocol (RCTAutoInsetsProtocol)]) {
You can’t perform that action at this time.
0 commit comments