Pārlūkot izejas kodu

Allow customTitleView and customNavigationBarView to be transparent (#2908)

frankenthumbs 6 gadus atpakaļ
vecāks
revīzija
193f8ed334
1 mainītis faili ar 11 papildinājumiem un 7 dzēšanām
  1. 11
    7
      lib/ios/RNNRootViewController.m

+ 11
- 7
lib/ios/RNNRootViewController.m Parādīt failu

@@ -27,11 +27,11 @@
27 27
 	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.options.customTransition];
28 28
 	self.creator = creator;
29 29
 	self.isExternalComponent = isExternalComponent;
30
-	
30
+
31 31
 	if (!self.isExternalComponent) {
32 32
 		self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
33 33
 	}
34
-	
34
+
35 35
 	[[NSNotificationCenter defaultCenter] addObserver:self
36 36
 											 selector:@selector(onJsReload)
37 37
 												 name:RCTJavaScriptWillStartLoadingNotification
@@ -40,11 +40,11 @@
40 40
 
41 41
 	return self;
42 42
 }
43
-	
43
+
44 44
 -(void)viewWillAppear:(BOOL)animated{
45 45
 	[super viewWillAppear:animated];
46 46
 	[self.options applyOn:self];
47
-	
47
+
48 48
 	[self setCustomNavigationTitleView];
49 49
 	[self setCustomNavigationBarView];
50 50
 	[self setCustomNavigationComponentBackground];
@@ -75,8 +75,10 @@
75 75
 - (void)setCustomNavigationTitleView {
76 76
 	if (self.options.topBar.title.component) {
77 77
 		RCTRootView *reactView = (RCTRootView*)[_creator createRootView:self.options.topBar.title.component rootViewId:self.options.topBar.title.component];
78
-		
78
+
79 79
 		RNNCustomTitleView *titleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:self.options.topBar.title.componentAlignment];
80
+        reactView.backgroundColor = UIColor.clearColor;
81
+		titleView.backgroundColor = UIColor.clearColor;
80 82
 		self.navigationItem.titleView = titleView;
81 83
 	}
82 84
 }
@@ -84,8 +86,10 @@
84 86
 - (void)setCustomNavigationBarView {
85 87
 	if (self.options.topBar.componentName) {
86 88
 		RCTRootView *reactView = (RCTRootView*)[_creator createRootView:self.options.topBar.componentName rootViewId:@"navBar"];
87
-		
89
+
88 90
 		RNNCustomTitleView *titleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
91
+		reactView.backgroundColor = UIColor.clearColor;
92
+		titleView.backgroundColor = UIColor.clearColor;
89 93
 		[self.navigationController.navigationBar addSubview:titleView];
90 94
 	}
91 95
 }
@@ -93,7 +97,7 @@
93 97
 - (void)setCustomNavigationComponentBackground {
94 98
 	if (self.options.topBar.backgroundComponentName) {
95 99
 		RCTRootView *reactView = (RCTRootView*)[_creator createRootView:self.options.topBar.backgroundComponentName rootViewId:@"navBarBackground"];
96
-		
100
+
97 101
 		RNNCustomTitleView *titleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
98 102
 		[self.navigationController.navigationBar insertSubview:titleView atIndex:1];
99 103
 	}