Browse Source

Set CollapsingTitleBar background only once

This is a quick hack to address issue where the expended color was
set after pop even if screen was collapsed.
Guy Carmeli 7 years ago
parent
commit
68040608b8

+ 6
- 4
android/app/src/main/java/com/reactnativenavigation/views/collapsingToolbar/CollapsingTitleBar.java View File

@@ -97,10 +97,12 @@ public class CollapsingTitleBar extends TitleBar implements View.OnTouchListener
97 97
 
98 98
     @Override
99 99
     protected void setBackground(StyleParams params) {
100
-        titleBarBackground = createBackground(params,
101
-                params.collapsingTopBarParams.expendedTitleBarColor,
102
-                params.collapsingTopBarParams.scrimColor);
103
-        setBackground(titleBarBackground);
100
+        if (titleBarBackground == null) {
101
+            titleBarBackground = createBackground(params,
102
+                    params.collapsingTopBarParams.expendedTitleBarColor,
103
+                    params.collapsingTopBarParams.scrimColor);
104
+            setBackground(titleBarBackground);
105
+        }
104 106
     }
105 107
 
106 108
     private TitleBarBackground createBackground(StyleParams styleParams, StyleParams.Color expendedColor, StyleParams.Color collapsedColor) {