Browse Source

Fix push in TopTabs

Guy Carmeli 8 years ago
parent
commit
dbe329521f

+ 8
- 2
android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java View File

10
 
10
 
11
 import com.reactnativenavigation.R;
11
 import com.reactnativenavigation.R;
12
 import com.reactnativenavigation.params.ScreenParams;
12
 import com.reactnativenavigation.params.ScreenParams;
13
+import com.reactnativenavigation.utils.ViewUtils;
13
 import com.reactnativenavigation.views.ContentView;
14
 import com.reactnativenavigation.views.ContentView;
14
 import com.reactnativenavigation.views.LeftButtonOnClickListener;
15
 import com.reactnativenavigation.views.LeftButtonOnClickListener;
15
 
16
 
123
     }
124
     }
124
 
125
 
125
     @Override
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 View File

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