Browse Source

Missing fab in pushed screen (#613)

* Fix navigator buttons immutability issue

* Show fab in pushed screen
Guy Carmeli 8 years ago
parent
commit
5640718604

+ 1
- 6
android/app/src/main/java/com/reactnativenavigation/events/ScreenChangedEvent.java View File

2
 
2
 
3
 import com.reactnativenavigation.params.BaseScreenParams;
3
 import com.reactnativenavigation.params.BaseScreenParams;
4
 import com.reactnativenavigation.params.FabParams;
4
 import com.reactnativenavigation.params.FabParams;
5
-import com.reactnativenavigation.params.PageParams;
6
 
5
 
7
 public class ScreenChangedEvent implements Event {
6
 public class ScreenChangedEvent implements Event {
8
     public static final String TYPE = "ScreenChangedEvent";
7
     public static final String TYPE = "ScreenChangedEvent";
9
     public FabParams fabParams;
8
     public FabParams fabParams;
10
 
9
 
11
     public ScreenChangedEvent(BaseScreenParams screenParams) {
10
     public ScreenChangedEvent(BaseScreenParams screenParams) {
12
-        this.fabParams = screenParams.fabParams;
13
-    }
14
-
15
-    public ScreenChangedEvent(PageParams topTabParams) {
16
-        this.fabParams = topTabParams.fabParams;
11
+        this.fabParams = screenParams.getFab();
17
     }
12
     }
18
 
13
 
19
     @Override
14
     @Override

+ 4
- 0
android/app/src/main/java/com/reactnativenavigation/params/BaseScreenParams.java View File

38
     public boolean hasCollapsingTopBar() {
38
     public boolean hasCollapsingTopBar() {
39
         return styleParams.collapsingTopBarParams != null;
39
         return styleParams.collapsingTopBarParams != null;
40
     }
40
     }
41
+
42
+    public FabParams getFab() {
43
+        return fabParams;
44
+    }
41
 }
45
 }

+ 4
- 0
android/app/src/main/java/com/reactnativenavigation/params/ScreenParams.java View File

12
     public boolean hasTopTabs() {
12
     public boolean hasTopTabs() {
13
         return topTabParams != null && !topTabParams.isEmpty();
13
         return topTabParams != null && !topTabParams.isEmpty();
14
     }
14
     }
15
+
16
+    public FabParams getFab() {
17
+        return hasTopTabs() ? topTabParams.get(0).fabParams : null;
18
+    }
15
 }
19
 }

+ 1
- 2
src/deprecated/platformSpecificDeprecated.android.js View File

36
 }
36
 }
37
 
37
 
38
 function adaptTopTabs(screen, navigatorID) {
38
 function adaptTopTabs(screen, navigatorID) {
39
+  screen.topTabs = _.cloneDeep(screen.topTabs);
39
   _.forEach(_.get(screen, 'topTabs'), (tab) => {
40
   _.forEach(_.get(screen, 'topTabs'), (tab) => {
40
     addNavigatorParams(tab);
41
     addNavigatorParams(tab);
41
     if (navigatorID) {
42
     if (navigatorID) {
279
     }
280
     }
280
   }
281
   }
281
   const fab = getFab(params);
282
   const fab = getFab(params);
282
-  console.log('params: ', JSON.stringify(params));
283
-  console.log('fab: ', JSON.stringify(fab));
284
   newPlatformSpecific.setScreenButtons(navigator.screenInstanceID, navigatorEventID, params.rightButtons, leftButton, fab);
283
   newPlatformSpecific.setScreenButtons(navigator.screenInstanceID, navigatorEventID, params.rightButtons, leftButton, fab);
285
 }
284
 }
286
 
285