Browse Source

Recreate topBar background controller after it is destroyed

Guy Carmeli 6 years ago
parent
commit
be77d993b9

+ 5
- 0
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarBackgroundViewController.java View File

@@ -18,6 +18,11 @@ public class TopBarBackgroundViewController extends ViewController<TopBarBackgro
18 18
         this.viewCreator = viewCreator;
19 19
     }
20 20
 
21
+    public TopBarBackgroundViewController(TopBarBackgroundViewController topBarBackgroundViewController) {
22
+        super(topBarBackgroundViewController.getActivity(), CompatUtils.generateViewId() + "", new Options());
23
+        this.viewCreator = topBarBackgroundViewController.viewCreator;
24
+    }
25
+
21 26
     @Override
22 27
     protected TopBarBackgroundView createView() {
23 28
         return viewCreator.create(getActivity(), getId(), component);

+ 1
- 0
lib/android/app/src/main/java/com/reactnativenavigation/views/topbar/TopBar.java View File

@@ -193,6 +193,7 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
193 193
 
194 194
     public void clear() {
195 195
         topBarBackgroundViewController.destroy();
196
+        topBarBackgroundViewController = new TopBarBackgroundViewController(topBarBackgroundViewController);
196 197
         titleBar.clear();
197 198
     }
198 199