| 
				
			 | 
			
			
				@@ -45,10 +45,7 @@ import java.util.LinkedHashMap; 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				45
			 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				46
			 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				47
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				48
			 | 
			
				
			 | 
			
			
				-import static com.reactnativenavigation.utils.CollectionUtils.filter; 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				
			 | 
			
			
				-import static com.reactnativenavigation.utils.CollectionUtils.forEach; 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				
			 | 
			
			
				-import static com.reactnativenavigation.utils.CollectionUtils.keyBy; 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				
			 | 
			
			
				-import static com.reactnativenavigation.utils.CollectionUtils.merge; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+import static com.reactnativenavigation.utils.CollectionUtils.*; 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				49
			 | 
			
			
				 import static com.reactnativenavigation.utils.ObjectUtils.perform; 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				50
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				54
			 | 
			
				51
			 | 
			
			
				 public class StackPresenter { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -205,8 +202,9 @@ public class StackPresenter { 
			 | 
		
	
		
			
			| 
				205
			 | 
			
				202
			 | 
			
			
				         topBar.setBackgroundColor(options.background.color.get(Color.WHITE)); 
			 | 
		
	
		
			
			| 
				206
			 | 
			
				203
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				207
			 | 
			
				204
			 | 
			
			
				         if (options.background.component.hasValue()) { 
			 | 
		
	
		
			
			| 
				208
			 | 
			
				
			 | 
			
			
				-            if (backgroundControllers.containsKey(component)) { 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				
			 | 
			
			
				-                topBar.setBackgroundComponent(backgroundControllers.get(component).getView()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				205
			 | 
			
			
				+            View createdComponent = findBackgroundComponent(options.background.component); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				206
			 | 
			
			
				+            if (createdComponent != null) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				207
			 | 
			
			
				+                topBar.setBackgroundComponent(createdComponent); 
			 | 
		
	
		
			
			| 
				210
			 | 
			
				208
			 | 
			
			
				             } else { 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				209
			 | 
			
			
				                 TopBarBackgroundViewController controller = new TopBarBackgroundViewController(activity, topBarBackgroundViewCreator); 
			 | 
		
	
		
			
			| 
				212
			 | 
			
				210
			 | 
			
			
				                 controller.setWaitForRender(options.background.waitForRender); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -215,6 +213,8 @@ public class StackPresenter { 
			 | 
		
	
		
			
			| 
				215
			 | 
			
				213
			 | 
			
			
				                 controller.getView().setLayoutParams(new RelativeLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); 
			 | 
		
	
		
			
			| 
				216
			 | 
			
				214
			 | 
			
			
				                 topBar.setBackgroundComponent(controller.getView()); 
			 | 
		
	
		
			
			| 
				217
			 | 
			
				215
			 | 
			
			
				             } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+        } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				217
			 | 
			
			
				+            topBar.clearBackgroundComponent(); 
			 | 
		
	
		
			
			| 
				218
			 | 
			
				218
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				219
			 | 
			
				219
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				220
			 | 
			
				220
			 | 
			
			
				         if (options.testId.hasValue()) topBar.setTestId(options.testId.get()); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -233,6 +233,17 @@ public class StackPresenter { 
			 | 
		
	
		
			
			| 
				233
			 | 
			
				233
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				234
			 | 
			
				234
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				235
			 | 
			
				235
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				236
			 | 
			
			
				+    @Nullable 
			 | 
		
	
		
			
			| 
				
			 | 
			
				237
			 | 
			
			
				+    private View findBackgroundComponent(com.reactnativenavigation.parse.Component component) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				238
			 | 
			
			
				+        for (TopBarBackgroundViewController controller : backgroundControllers.values()) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				239
			 | 
			
			
				+            if (ObjectUtils.equalsNotNull(controller.getComponent().name.get(null), component.name.get(null)) && 
			 | 
		
	
		
			
			| 
				
			 | 
			
				240
			 | 
			
			
				+                ObjectUtils.equalsNotNull(controller.getComponent().componentId.get(null), component.componentId.get(null))) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				241
			 | 
			
			
				+                return controller.getView(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				242
			 | 
			
			
				+            } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				243
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				244
			 | 
			
			
				+        return null; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				245
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				246
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				236
			 | 
			
				247
			 | 
			
			
				     private void setInitialTopBarVisibility(TopBarOptions options) { 
			 | 
		
	
		
			
			| 
				237
			 | 
			
				248
			 | 
			
			
				         if (options.visible.isFalse()) { 
			 | 
		
	
		
			
			| 
				238
			 | 
			
				249
			 | 
			
			
				             topBar.hide(); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -268,7 +279,7 @@ public class StackPresenter { 
			 | 
		
	
		
			
			| 
				268
			 | 
			
				279
			 | 
			
			
				             componentRightButtons.put(child, keyBy(rightButtonControllers, TitleBarButtonController::getButtonInstanceId)); 
			 | 
		
	
		
			
			| 
				269
			 | 
			
				280
			 | 
			
			
				             topBar.setRightButtons(rightButtonControllers); 
			 | 
		
	
		
			
			| 
				270
			 | 
			
				281
			 | 
			
			
				         } else { 
			 | 
		
	
		
			
			| 
				271
			 | 
			
				
			 | 
			
			
				-            topBar.setRightButtons(null); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				282
			 | 
			
			
				+            topBar.clearRightButtons(); 
			 | 
		
	
		
			
			| 
				272
			 | 
			
				283
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				273
			 | 
			
				284
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				274
			 | 
			
				285
			 | 
			
			
				         if (leftButtons != null) { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -276,7 +287,7 @@ public class StackPresenter { 
			 | 
		
	
		
			
			| 
				276
			 | 
			
				287
			 | 
			
			
				             componentLeftButtons.put(child, keyBy(leftButtonControllers, TitleBarButtonController::getButtonInstanceId)); 
			 | 
		
	
		
			
			| 
				277
			 | 
			
				288
			 | 
			
			
				             topBar.setLeftButtons(leftButtonControllers); 
			 | 
		
	
		
			
			| 
				278
			 | 
			
				289
			 | 
			
			
				         } else { 
			 | 
		
	
		
			
			| 
				279
			 | 
			
				
			 | 
			
			
				-            topBar.setLeftButtons(null); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				290
			 | 
			
			
				+            topBar.clearLeftButtons(); 
			 | 
		
	
		
			
			| 
				280
			 | 
			
				291
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				281
			 | 
			
				292
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				282
			 | 
			
				293
			 | 
			
			
				         if (options.buttons.back.visible.isTrue() && !options.buttons.hasLeftButtons()) { 
			 |