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
     public void onViewAppeared() {
21
     public void onViewAppeared() {
22
         super.onViewAppeared();
22
         super.onViewAppeared();
23
         runOnPreDraw(view -> view.setLayoutParams(view.getLayoutParams()));
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
     @Override
33
     @Override

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

112
                 throw new RuntimeException("Tried to create view after it has already been destroyed");
112
                 throw new RuntimeException("Tried to create view after it has already been destroyed");
113
             }
113
             }
114
             view = createView();
114
             view = createView();
115
-            if (view.getId() != 0) {
115
+            if (view.getId() < 0) {
116
                 view.setId(CompatUtils.generateViewId());
116
                 view.setId(CompatUtils.generateViewId());
117
             }
117
             }
118
             view.getViewTreeObserver().addOnGlobalLayoutListener(this);
118
             view.getViewTreeObserver().addOnGlobalLayoutListener(this);