Ver código fonte

Fix push in TopTabs

Guy Carmeli 8 anos atrás
pai
commit
dbe329521f

+ 8
- 2
android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java Ver arquivo

@@ -10,6 +10,7 @@ import android.widget.FrameLayout;
10 10
 
11 11
 import com.reactnativenavigation.R;
12 12
 import com.reactnativenavigation.params.ScreenParams;
13
+import com.reactnativenavigation.utils.ViewUtils;
13 14
 import com.reactnativenavigation.views.ContentView;
14 15
 import com.reactnativenavigation.views.LeftButtonOnClickListener;
15 16
 
@@ -123,7 +124,12 @@ public class FragmentScreen extends Screen {
123 124
     }
124 125
 
125 126
     @Override
126
-    public void setOnDisplayListener(OnDisplayListener onContentViewDisplayedListener) {
127
-        // nothing
127
+    public void setOnDisplayListener(final OnDisplayListener onContentViewDisplayedListener) {
128
+        ViewUtils.runOnPreDraw(content, new Runnable() {
129
+            @Override
130
+            public void run() {
131
+                onContentViewDisplayedListener.onDisplay();
132
+            }
133
+        });
128 134
     }
129 135
 }

+ 9
- 6
src/deprecated/platformSpecificDeprecated.android.js Ver arquivo

@@ -22,7 +22,7 @@ function startSingleScreenApp(params) {
22 22
   /*
23 23
    * adapt to new API
24 24
    */
25
-  adaptTopTabs(screen);
25
+  adaptTopTabs(screen, screen.navigatorID);
26 26
   screen.screenId = screen.screen;
27 27
   params.screen = adaptNavigationStyleToScreenStyle(screen);
28 28
   params.screen = adaptNavigationParams(screen);
@@ -33,9 +33,12 @@ function startSingleScreenApp(params) {
33 33
   newPlatformSpecific.startApp(params);
34 34
 }
35 35
 
36
-function adaptTopTabs(screen) {
36
+function adaptTopTabs(screen, navigatorID) {
37 37
   _.forEach(_.get(screen, 'topTabs'), (tab) => {
38 38
     addNavigatorParams(tab);
39
+    if (navigatorID) {
40
+      tab.navigatorID = navigatorID;
41
+    }
39 42
     adaptNavigationParams(tab);
40 43
   });
41 44
 }
@@ -46,7 +49,7 @@ function navigatorPush(navigator, params) {
46 49
   addTitleBarBackButtonIfNeeded(params);
47 50
   addNavigationStyleParams(params);
48 51
 
49
-  adaptTopTabs(params);
52
+  adaptTopTabs(params, params.navigatorID);
50 53
 
51 54
   params.screenId = params.screen;
52 55
   let adapted = adaptNavigationStyleToScreenStyle(params);
@@ -81,7 +84,7 @@ function navigatorResetTo(navigator, params) {
81 84
   addNavigatorButtons(params);
82 85
   addNavigationStyleParams(params);
83 86
 
84
-  adaptTopTabs(params);
87
+  adaptTopTabs(params, params.navigatorID);
85 88
 
86 89
   params.screenId = params.screen;
87 90
   let adapted = adaptNavigationStyleToScreenStyle(params);
@@ -174,7 +177,7 @@ function startTabBasedApp(params) {
174 177
     addTabIcon(tab);
175 178
     tab.passProps = params.passProps;
176 179
 
177
-    adaptTopTabs(tab);
180
+    adaptTopTabs(tab, tab.navigatorID);
178 181
 
179 182
     tab.screenId = tab.screen;
180 183
 
@@ -281,7 +284,7 @@ function showModal(params) {
281 284
   /*
282 285
    * adapt to new API
283 286
    */
284
-  adaptTopTabs(params);
287
+  adaptTopTabs(params, params.navigatorID);
285 288
   params.screenId = params.screen;
286 289
   let adapted = adaptNavigationStyleToScreenStyle(params);
287 290
   adapted = adaptNavigationParams(adapted);