Browse Source

Send start/stop events to title component

Guy Carmeli 6 years ago
parent
commit
cdbeb9cfd7

+ 7
- 0
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/TitleBarReactViewController.java View File

@@ -21,6 +21,13 @@ public class TitleBarReactViewController extends ViewController<TitleBarReactVie
21 21
     public void onViewAppeared() {
22 22
         super.onViewAppeared();
23 23
         runOnPreDraw(view -> view.setLayoutParams(view.getLayoutParams()));
24
+        view.sendComponentStart();
25
+    }
26
+
27
+    @Override
28
+    public void onViewDisappear() {
29
+        view.sendComponentStop();
30
+        super.onViewDisappear();
24 31
     }
25 32
 
26 33
     @Override

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java View File

@@ -112,7 +112,7 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
112 112
                 throw new RuntimeException("Tried to create view after it has already been destroyed");
113 113
             }
114 114
             view = createView();
115
-            if (view.getId() != 0) {
115
+            if (view.getId() < 0) {
116 116
                 view.setId(CompatUtils.generateViewId());
117 117
             }
118 118
             view.getViewTreeObserver().addOnGlobalLayoutListener(this);