Daniel Zlotin 8 years ago
parent
commit
1718798d7d

+ 12
- 3
android/app/src/main/java/com/reactnativenavigation/bridge/NavigationReactModule.java View File

8
 import com.facebook.react.bridge.ReadableMap;
8
 import com.facebook.react.bridge.ReadableMap;
9
 import com.reactnativenavigation.controllers.NavigationCommandsHandler;
9
 import com.reactnativenavigation.controllers.NavigationCommandsHandler;
10
 import com.reactnativenavigation.params.ContextualMenuParams;
10
 import com.reactnativenavigation.params.ContextualMenuParams;
11
+import com.reactnativenavigation.params.FabParams;
11
 import com.reactnativenavigation.params.SnackbarParams;
12
 import com.reactnativenavigation.params.SnackbarParams;
12
 import com.reactnativenavigation.params.TitleBarButtonParams;
13
 import com.reactnativenavigation.params.TitleBarButtonParams;
13
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
14
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
14
 import com.reactnativenavigation.params.parsers.ContextualMenuParamsParser;
15
 import com.reactnativenavigation.params.parsers.ContextualMenuParamsParser;
16
+import com.reactnativenavigation.params.parsers.FabParamsParser;
15
 import com.reactnativenavigation.params.parsers.SnackbarParamsParser;
17
 import com.reactnativenavigation.params.parsers.SnackbarParamsParser;
16
 import com.reactnativenavigation.params.parsers.TitleBarButtonParamsParser;
18
 import com.reactnativenavigation.params.parsers.TitleBarButtonParamsParser;
17
 import com.reactnativenavigation.params.parsers.TitleBarLeftButtonParamsParser;
19
 import com.reactnativenavigation.params.parsers.TitleBarLeftButtonParamsParser;
70
     }
72
     }
71
 
73
 
72
     @ReactMethod
74
     @ReactMethod
73
-    public void setScreenTitleBarButtons(String screenInstanceId, String navigatorEventId,
74
-                                         ReadableArray rightButtonsParams, ReadableMap leftButtonParams) {
75
+    public void setScreenButtons(String screenInstanceId, String navigatorEventId,
76
+                                 ReadableArray rightButtonsParams, ReadableMap leftButtonParams, ReadableMap fab) {
75
         if (rightButtonsParams != null) {
77
         if (rightButtonsParams != null) {
76
             setScreenTitleBarRightButtons(screenInstanceId, navigatorEventId, rightButtonsParams);
78
             setScreenTitleBarRightButtons(screenInstanceId, navigatorEventId, rightButtonsParams);
77
         }
79
         }
78
-
79
         if (leftButtonParams != null) {
80
         if (leftButtonParams != null) {
80
             setScreenTitleBarLeftButton(screenInstanceId, navigatorEventId, leftButtonParams);
81
             setScreenTitleBarLeftButton(screenInstanceId, navigatorEventId, leftButtonParams);
81
         }
82
         }
83
+        if (fab != null) {
84
+            setScreenFab(screenInstanceId, navigatorEventId, fab);
85
+        }
82
     }
86
     }
83
 
87
 
84
     private void setScreenTitleBarRightButtons(String screenInstanceId, String navigatorEventId, ReadableArray rightButtonsParams) {
88
     private void setScreenTitleBarRightButtons(String screenInstanceId, String navigatorEventId, ReadableArray rightButtonsParams) {
93
         NavigationCommandsHandler.setScreenTitleBarLeftButtons(screenInstanceId, navigatorEventId, leftButton);
97
         NavigationCommandsHandler.setScreenTitleBarLeftButtons(screenInstanceId, navigatorEventId, leftButton);
94
     }
98
     }
95
 
99
 
100
+    private void setScreenFab(String screenInstanceId, String navigatorEventId, ReadableMap fab) {
101
+        FabParams fabParams = new FabParamsParser().parse(BundleConverter.toBundle(fab), navigatorEventId);
102
+        NavigationCommandsHandler.setScreenFab(screenInstanceId, navigatorEventId, fabParams);
103
+    }
104
+
96
     @ReactMethod
105
     @ReactMethod
97
     public void setBottomTabBadgeByIndex(Integer index, String badge) {
106
     public void setBottomTabBadgeByIndex(Integer index, String badge) {
98
         NavigationCommandsHandler.setBottomTabBadgeByIndex(index, badge);
107
         NavigationCommandsHandler.setBottomTabBadgeByIndex(index, badge);

+ 5
- 0
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

24
 import com.reactnativenavigation.params.ActivityParams;
24
 import com.reactnativenavigation.params.ActivityParams;
25
 import com.reactnativenavigation.params.AppStyle;
25
 import com.reactnativenavigation.params.AppStyle;
26
 import com.reactnativenavigation.params.ContextualMenuParams;
26
 import com.reactnativenavigation.params.ContextualMenuParams;
27
+import com.reactnativenavigation.params.FabParams;
27
 import com.reactnativenavigation.params.ScreenParams;
28
 import com.reactnativenavigation.params.ScreenParams;
28
 import com.reactnativenavigation.params.SnackbarParams;
29
 import com.reactnativenavigation.params.SnackbarParams;
29
 import com.reactnativenavigation.params.TitleBarButtonParams;
30
 import com.reactnativenavigation.params.TitleBarButtonParams;
254
         modalController.setTitleBarLeftButton(screenInstanceId, navigatorEventId, titleBarLeftButton);
255
         modalController.setTitleBarLeftButton(screenInstanceId, navigatorEventId, titleBarLeftButton);
255
     }
256
     }
256
 
257
 
258
+    void setScreenFab(String screenInstanceId, String navigatorEventId, FabParams fab) {
259
+        layout.setFab(screenInstanceId, navigatorEventId, fab);
260
+    }
261
+
257
     public void toggleSideMenuVisible(boolean animated, Side side) {
262
     public void toggleSideMenuVisible(boolean animated, Side side) {
258
         layout.toggleSideMenuVisible(animated, side);
263
         layout.toggleSideMenuVisible(animated, side);
259
     }
264
     }

+ 14
- 0
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationCommandsHandler.java View File

7
 import com.reactnativenavigation.NavigationApplication;
7
 import com.reactnativenavigation.NavigationApplication;
8
 import com.reactnativenavigation.params.ActivityParams;
8
 import com.reactnativenavigation.params.ActivityParams;
9
 import com.reactnativenavigation.params.ContextualMenuParams;
9
 import com.reactnativenavigation.params.ContextualMenuParams;
10
+import com.reactnativenavigation.params.FabParams;
10
 import com.reactnativenavigation.params.ScreenParams;
11
 import com.reactnativenavigation.params.ScreenParams;
11
 import com.reactnativenavigation.params.SnackbarParams;
12
 import com.reactnativenavigation.params.SnackbarParams;
12
 import com.reactnativenavigation.params.TitleBarButtonParams;
13
 import com.reactnativenavigation.params.TitleBarButtonParams;
210
         });
211
         });
211
     }
212
     }
212
 
213
 
214
+    public static void setScreenFab(final String screenInstanceId, final String navigatorEventId, final FabParams fab) {
215
+        final NavigationActivity currentActivity = NavigationActivity.currentActivity;
216
+        if (currentActivity == null) {
217
+            return;
218
+        }
219
+        NavigationApplication.instance.runOnMainThread(new Runnable() {
220
+            @Override
221
+            public void run() {
222
+                currentActivity.setScreenFab(screenInstanceId, navigatorEventId, fab);
223
+            }
224
+        });
225
+    }
226
+
213
     public static void dismissTopModal() {
227
     public static void dismissTopModal() {
214
         final NavigationActivity currentActivity = NavigationActivity.currentActivity;
228
         final NavigationActivity currentActivity = NavigationActivity.currentActivity;
215
         if (currentActivity == null) {
229
         if (currentActivity == null) {

+ 18
- 0
android/app/src/main/java/com/reactnativenavigation/events/FabSetEvent.java View File

1
+package com.reactnativenavigation.events;
2
+
3
+import com.reactnativenavigation.params.FabParams;
4
+
5
+public class FabSetEvent implements Event {
6
+    public static final String TYPE = "FabSetEvent";
7
+
8
+    public FabParams fabParams;
9
+
10
+    public FabSetEvent(FabParams fabParams) {
11
+        this.fabParams = fabParams;
12
+    }
13
+
14
+    @Override
15
+    public String getType() {
16
+        return TYPE;
17
+    }
18
+}

+ 17
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java View File

7
 import android.widget.RelativeLayout;
7
 import android.widget.RelativeLayout;
8
 
8
 
9
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
9
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
10
+import com.facebook.react.bridge.Arguments;
10
 import com.facebook.react.bridge.Callback;
11
 import com.facebook.react.bridge.Callback;
12
+import com.facebook.react.bridge.WritableMap;
11
 import com.reactnativenavigation.NavigationApplication;
13
 import com.reactnativenavigation.NavigationApplication;
12
 import com.reactnativenavigation.events.EventBus;
14
 import com.reactnativenavigation.events.EventBus;
13
 import com.reactnativenavigation.events.ScreenChangedEvent;
15
 import com.reactnativenavigation.events.ScreenChangedEvent;
14
 import com.reactnativenavigation.params.ActivityParams;
16
 import com.reactnativenavigation.params.ActivityParams;
15
 import com.reactnativenavigation.params.ContextualMenuParams;
17
 import com.reactnativenavigation.params.ContextualMenuParams;
18
+import com.reactnativenavigation.params.FabParams;
16
 import com.reactnativenavigation.params.ScreenParams;
19
 import com.reactnativenavigation.params.ScreenParams;
17
 import com.reactnativenavigation.params.SideMenuParams;
20
 import com.reactnativenavigation.params.SideMenuParams;
18
 import com.reactnativenavigation.params.SnackbarParams;
21
 import com.reactnativenavigation.params.SnackbarParams;
178
         }
181
         }
179
     }
182
     }
180
 
183
 
184
+    @Override
185
+    public void setFab(String screenInstanceId, String navigatorEventId, FabParams fabParams) {
186
+        for (int i = 0; i < bottomTabs.getItemsCount(); i++) {
187
+            screenStacks[i].setFab(screenInstanceId, navigatorEventId, fabParams);
188
+        }
189
+    }
190
+
181
     @Override
191
     @Override
182
     public void toggleSideMenuVisible(boolean animated, Side side) {
192
     public void toggleSideMenuVisible(boolean animated, Side side) {
183
         if (sideMenu != null) {
193
         if (sideMenu != null) {
290
         hideCurrentStack();
300
         hideCurrentStack();
291
         showNewStack(position);
301
         showNewStack(position);
292
         EventBus.instance.post(new ScreenChangedEvent(getCurrentScreenStack().peek().getScreenParams()));
302
         EventBus.instance.post(new ScreenChangedEvent(getCurrentScreenStack().peek().getScreenParams()));
303
+        sendTabSelectedEventToJs();
293
         return true;
304
         return true;
294
     }
305
     }
295
 
306
 
307
+    private void sendTabSelectedEventToJs() {
308
+        WritableMap data = Arguments.createMap();
309
+        String navigatorEventId = getCurrentScreenStack().peek().getNavigatorEventId();
310
+        NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("bottomTabSelected", navigatorEventId, data);
311
+    }
312
+
296
     private void showNewStack(int position) {
313
     private void showNewStack(int position) {
297
         showStackAndUpdateStyle(screenStacks[position]);
314
         showStackAndUpdateStyle(screenStacks[position]);
298
         currentStackIndex = position;
315
         currentStackIndex = position;

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/Layout.java View File

4
 
4
 
5
 import com.facebook.react.bridge.Callback;
5
 import com.facebook.react.bridge.Callback;
6
 import com.reactnativenavigation.params.ContextualMenuParams;
6
 import com.reactnativenavigation.params.ContextualMenuParams;
7
+import com.reactnativenavigation.params.FabParams;
7
 import com.reactnativenavigation.params.SnackbarParams;
8
 import com.reactnativenavigation.params.SnackbarParams;
8
 import com.reactnativenavigation.params.TitleBarButtonParams;
9
 import com.reactnativenavigation.params.TitleBarButtonParams;
9
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
10
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
26
 
27
 
27
     void setTitleBarLeftButton(String screenInstanceId, String navigatorEventId, TitleBarLeftButtonParams titleBarLeftButtonParams);
28
     void setTitleBarLeftButton(String screenInstanceId, String navigatorEventId, TitleBarLeftButtonParams titleBarLeftButtonParams);
28
 
29
 
30
+    void setFab(String screenInstanceId, String navigatorEventId, FabParams fabParams);
31
+
29
     void toggleSideMenuVisible(boolean animated, Side side);
32
     void toggleSideMenuVisible(boolean animated, Side side);
30
 
33
 
31
     void setSideMenuVisible(boolean animated, boolean visible, Side side);
34
     void setSideMenuVisible(boolean animated, boolean visible, Side side);

+ 6
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java View File

10
 import com.reactnativenavigation.events.EventBus;
10
 import com.reactnativenavigation.events.EventBus;
11
 import com.reactnativenavigation.events.ScreenChangedEvent;
11
 import com.reactnativenavigation.events.ScreenChangedEvent;
12
 import com.reactnativenavigation.params.ContextualMenuParams;
12
 import com.reactnativenavigation.params.ContextualMenuParams;
13
+import com.reactnativenavigation.params.FabParams;
13
 import com.reactnativenavigation.params.ScreenParams;
14
 import com.reactnativenavigation.params.ScreenParams;
14
 import com.reactnativenavigation.params.SideMenuParams;
15
 import com.reactnativenavigation.params.SideMenuParams;
15
 import com.reactnativenavigation.params.SnackbarParams;
16
 import com.reactnativenavigation.params.SnackbarParams;
185
         stack.setScreenTitleBarLeftButton(screenInstanceId, navigatorEventId, titleBarLeftButtonParams);
186
         stack.setScreenTitleBarLeftButton(screenInstanceId, navigatorEventId, titleBarLeftButtonParams);
186
     }
187
     }
187
 
188
 
189
+    @Override
190
+    public void setFab(String screenInstanceId, String navigatorEventId, FabParams fabParams) {
191
+        stack.setFab(screenInstanceId, navigatorEventId, fabParams);
192
+    }
193
+
188
     @Override
194
     @Override
189
     public void toggleSideMenuVisible(boolean animated, Side side) {
195
     public void toggleSideMenuVisible(boolean animated, Side side) {
190
         if (sideMenu != null) {
196
         if (sideMenu != null) {

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

16
     public boolean hasExpendedState() {
16
     public boolean hasExpendedState() {
17
         return actions != null && actions.size() > 0;
17
         return actions != null && actions.size() > 0;
18
     }
18
     }
19
+
20
+    public boolean isValid() {
21
+        return collapsedId != null;
22
+    }
19
 }
23
 }

+ 3
- 1
android/app/src/main/java/com/reactnativenavigation/params/parsers/ContextualMenuButtonParamsParser.java View File

20
 
20
 
21
     private ContextualMenuButtonParams parseSingleContextualMenuButton(Bundle button) {
21
     private ContextualMenuButtonParams parseSingleContextualMenuButton(Bundle button) {
22
         ContextualMenuButtonParams result = new ContextualMenuButtonParams();
22
         ContextualMenuButtonParams result = new ContextualMenuButtonParams();
23
-        result.icon = ImageLoader.loadImage(button.getString("icon"));
23
+        if (button.get("icon") != null) {
24
+            result.icon = ImageLoader.loadImage(button.getString("icon"));
25
+        }
24
         result.showAsAction = parseShowAsAction(button.getString("showAsAction"));
26
         result.showAsAction = parseShowAsAction(button.getString("showAsAction"));
25
         result.color = StyleParams.Color.parse(button, "color");
27
         result.color = StyleParams.Color.parse(button, "color");
26
         result.label = button.getString("label");
28
         result.label = button.getString("label");

+ 9
- 0
android/app/src/main/java/com/reactnativenavigation/screens/Screen.java View File

13
 import com.reactnativenavigation.events.ContextualMenuHiddenEvent;
13
 import com.reactnativenavigation.events.ContextualMenuHiddenEvent;
14
 import com.reactnativenavigation.events.Event;
14
 import com.reactnativenavigation.events.Event;
15
 import com.reactnativenavigation.events.EventBus;
15
 import com.reactnativenavigation.events.EventBus;
16
+import com.reactnativenavigation.events.FabSetEvent;
16
 import com.reactnativenavigation.events.Subscriber;
17
 import com.reactnativenavigation.events.Subscriber;
17
 import com.reactnativenavigation.events.ViewPagerScreenChangedEvent;
18
 import com.reactnativenavigation.events.ViewPagerScreenChangedEvent;
18
 import com.reactnativenavigation.params.BaseScreenParams;
19
 import com.reactnativenavigation.params.BaseScreenParams;
19
 import com.reactnativenavigation.params.ContextualMenuParams;
20
 import com.reactnativenavigation.params.ContextualMenuParams;
21
+import com.reactnativenavigation.params.FabParams;
20
 import com.reactnativenavigation.params.ScreenParams;
22
 import com.reactnativenavigation.params.ScreenParams;
21
 import com.reactnativenavigation.params.StyleParams;
23
 import com.reactnativenavigation.params.StyleParams;
22
 import com.reactnativenavigation.params.TitleBarButtonParams;
24
 import com.reactnativenavigation.params.TitleBarButtonParams;
192
                 screenParams.overrideBackPressInJs);
194
                 screenParams.overrideBackPressInJs);
193
     }
195
     }
194
 
196
 
197
+    public void setFab(FabParams fabParams) {
198
+        screenParams.fabParams = fabParams;
199
+        if (isShown()) {
200
+            EventBus.instance.post(new FabSetEvent(fabParams));
201
+        }
202
+    }
203
+
195
     public StyleParams getStyleParams() {
204
     public StyleParams getStyleParams() {
196
         return screenParams.styleParams;
205
         return screenParams.styleParams;
197
     }
206
     }

+ 10
- 0
android/app/src/main/java/com/reactnativenavigation/screens/ScreenStack.java View File

10
 import com.facebook.react.bridge.Callback;
10
 import com.facebook.react.bridge.Callback;
11
 import com.reactnativenavigation.NavigationApplication;
11
 import com.reactnativenavigation.NavigationApplication;
12
 import com.reactnativenavigation.params.ContextualMenuParams;
12
 import com.reactnativenavigation.params.ContextualMenuParams;
13
+import com.reactnativenavigation.params.FabParams;
13
 import com.reactnativenavigation.params.ScreenParams;
14
 import com.reactnativenavigation.params.ScreenParams;
14
 import com.reactnativenavigation.params.StyleParams;
15
 import com.reactnativenavigation.params.StyleParams;
15
 import com.reactnativenavigation.params.TitleBarButtonParams;
16
 import com.reactnativenavigation.params.TitleBarButtonParams;
234
         });
235
         });
235
     }
236
     }
236
 
237
 
238
+    public void setFab(String screenInstanceId, final String navigatorEventId, final FabParams fabParams) {
239
+        performOnScreen(screenInstanceId, new Task<Screen>() {
240
+            @Override
241
+            public void run(Screen param) {
242
+                param.setFab(fabParams);
243
+            }
244
+        });
245
+    }
246
+
237
     public void showContextualMenu(String screenInstanceId, final ContextualMenuParams params, final Callback onButtonClicked) {
247
     public void showContextualMenu(String screenInstanceId, final ContextualMenuParams params, final Callback onButtonClicked) {
238
         performOnScreen(screenInstanceId, new Task<Screen>() {
248
         performOnScreen(screenInstanceId, new Task<Screen>() {
239
             @Override
249
             @Override

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/views/FloatingActionButtonCoordinator.java View File

44
 
44
 
45
     public void add(FabParams params) {
45
     public void add(FabParams params) {
46
         this.params = params;
46
         this.params = params;
47
+        if (!params.isValid()) {
48
+            return;
49
+        }
47
         createCollapsedFab();
50
         createCollapsedFab();
48
         createExpendedFab();
51
         createExpendedFab();
49
         setStyle();
52
         setStyle();

+ 5
- 1
android/app/src/main/java/com/reactnativenavigation/views/SnackbarAndFabContainer.java View File

5
 
5
 
6
 import com.reactnativenavigation.events.Event;
6
 import com.reactnativenavigation.events.Event;
7
 import com.reactnativenavigation.events.EventBus;
7
 import com.reactnativenavigation.events.EventBus;
8
+import com.reactnativenavigation.events.FabSetEvent;
8
 import com.reactnativenavigation.events.ScreenChangedEvent;
9
 import com.reactnativenavigation.events.ScreenChangedEvent;
9
 import com.reactnativenavigation.events.Subscriber;
10
 import com.reactnativenavigation.events.Subscriber;
10
 import com.reactnativenavigation.params.FabParams;
11
 import com.reactnativenavigation.params.FabParams;
38
 
39
 
39
     @Override
40
     @Override
40
     public void onEvent(Event event) {
41
     public void onEvent(Event event) {
41
-        if (event.getType() == ScreenChangedEvent.TYPE) {
42
+        if (ScreenChangedEvent.TYPE.equals(event.getType())) {
42
             onScreenChange(((ScreenChangedEvent) event).fabParams);
43
             onScreenChange(((ScreenChangedEvent) event).fabParams);
43
         }
44
         }
45
+        if (FabSetEvent.TYPE.equals(event.getType())) {
46
+            updateFab(((FabSetEvent) event).fabParams);
47
+        }
44
     }
48
     }
45
 
49
 
46
     private void onScreenChange(FabParams fabParams) {
50
     private void onScreenChange(FabParams fabParams) {

+ 20
- 0
ios/RCCTabBarController.m View File

2
 #import "RCCViewController.h"
2
 #import "RCCViewController.h"
3
 #import "RCTConvert.h"
3
 #import "RCTConvert.h"
4
 #import "RCCManager.h"
4
 #import "RCCManager.h"
5
+#import "RCTUIManager.h"
6
+
7
+@interface RCTUIManager ()
8
+
9
+- (void)configureNextLayoutAnimation:(NSDictionary *)config
10
+                        withCallback:(RCTResponseSenderBlock)callback
11
+                       errorCallback:(__unused RCTResponseSenderBlock)errorCallback;
12
+
13
+@end
5
 
14
 
6
 @implementation RCCTabBarController
15
 @implementation RCCTabBarController
7
 
16
 
17
+- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
18
+  id queue = [[RCCManager sharedInstance].getBridge uiManager].methodQueue;
19
+  dispatch_async(queue, ^{
20
+    [[[RCCManager sharedInstance].getBridge uiManager] configureNextLayoutAnimation:nil withCallback:^(NSArray* arr){} errorCallback:^(NSArray* arr){}];
21
+  });
22
+  
23
+  return YES;
24
+}
25
+
8
 - (UIImage *)image:(UIImage*)image withColor:(UIColor *)color1
26
 - (UIImage *)image:(UIImage*)image withColor:(UIColor *)color1
9
 {
27
 {
10
   UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
28
   UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
26
   self = [super init];
44
   self = [super init];
27
   if (!self) return nil;
45
   if (!self) return nil;
28
   
46
   
47
+  self.delegate = self;
48
+  
29
   self.tabBar.translucent = YES; // default
49
   self.tabBar.translucent = YES; // default
30
   
50
   
31
   UIColor *buttonColor = nil;
51
   UIColor *buttonColor = nil;

+ 2
- 2
src/Navigation.js View File

43
 
43
 
44
       render() {
44
       render() {
45
         return (
45
         return (
46
-          <InternalComponent navigator={this.navigator} {...this.state.internalProps} />
46
+          <InternalComponent testID={screenID} navigator={this.navigator} {...this.state.internalProps} />
47
         );
47
         );
48
       }
48
       }
49
     };
49
     };
75
       render() {
75
       render() {
76
         return (
76
         return (
77
           <Provider store={store}>
77
           <Provider store={store}>
78
-            <InternalComponent navigator={this.navigator} {...this.state.internalProps} />
78
+            <InternalComponent testID={screenID} navigator={this.navigator} {...this.state.internalProps} />
79
           </Provider>
79
           </Provider>
80
         );
80
         );
81
       }
81
       }

+ 38
- 23
src/deprecated/platformSpecificDeprecated.android.js View File

278
       }
278
       }
279
     }
279
     }
280
   }
280
   }
281
-  newPlatformSpecific.setScreenTitleBarButtons(navigator.screenInstanceID, navigatorEventID, params.rightButtons, leftButton);
281
+  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);
282
 }
285
 }
283
 
286
 
284
 function navigatorSetTabBadge(navigator, params) {
287
 function navigatorSetTabBadge(navigator, params) {
411
 }
414
 }
412
 
415
 
413
 function getFab(screen) {
416
 function getFab(screen) {
417
+  let fab = screen.fab;
414
   if (screen.navigatorButtons && screen.navigatorButtons.fab) {
418
   if (screen.navigatorButtons && screen.navigatorButtons.fab) {
415
-    const fab = screen.navigatorButtons.fab;
416
-    const collapsedIconUri = resolveAssetSource(fab.collapsedIcon);
417
-    if (!collapsedIconUri) {
418
-      return;
419
-    }
420
-    fab.collapsedIcon = collapsedIconUri.uri;
421
-    if (fab.expendedIcon) {
422
-      const expendedIconUri = resolveAssetSource(fab.expendedIcon);
423
-      if (expendedIconUri) {
424
-        fab.expendedIcon = expendedIconUri.uri;
425
-      }
426
-    }
427
-    if (fab.backgroundColor) {
428
-      fab.backgroundColor = processColor(fab.backgroundColor);
429
-    }
419
+    fab = screen.navigatorButtons.fab;
420
+  }
421
+  if (fab === null || fab === undefined) {
422
+    return;
423
+  }
424
+  if (Object.keys(fab).length === 0 ) {
425
+    return {};
426
+  }
430
 
427
 
431
-    if (fab.actions) {
432
-      _.forEach(fab.actions, (action) => {
433
-        action.icon = resolveAssetSource(action.icon).uri;
434
-        return action;
435
-      });
428
+  const collapsedIconUri = resolveAssetSource(fab.collapsedIcon);
429
+  if (!collapsedIconUri) {
430
+    return;
431
+  }
432
+  fab.collapsedIcon = collapsedIconUri.uri;
433
+  if (fab.expendedIcon) {
434
+    const expendedIconUri = resolveAssetSource(fab.expendedIcon);
435
+    if (expendedIconUri) {
436
+      fab.expendedIcon = expendedIconUri.uri;
436
     }
437
     }
438
+  }
439
+  if (fab.backgroundColor) {
440
+    fab.backgroundColor = processColor(fab.backgroundColor);
441
+  }
437
 
442
 
438
-    return fab;
443
+  if (fab.actions) {
444
+    _.forEach(fab.actions, (action) => {
445
+      action.icon = resolveAssetSource(action.icon).uri;
446
+      return action;
447
+    });
439
   }
448
   }
449
+
450
+  return fab;
440
 }
451
 }
441
 
452
 
442
 function createSideMenuButton() {
453
 function createSideMenuButton() {
509
 
520
 
510
   params.rightButtons.forEach((button, index) => {
521
   params.rightButtons.forEach((button, index) => {
511
     const btn = {
522
     const btn = {
512
-      icon: resolveAssetSource(button.icon).uri,
523
+      icon: resolveAssetSource(button.icon),
524
+      showAsAction: button.showAsAction,
513
       color: processColor(button.color),
525
       color: processColor(button.color),
514
       label: button.title,
526
       label: button.title,
515
       index
527
       index
516
     };
528
     };
529
+    if (btn.icon) {
530
+      btn.icon = btn.icon.uri;
531
+    }
517
     contextualMenu.buttons.push(btn);
532
     contextualMenu.buttons.push(btn);
518
   });
533
   });
519
 
534
 

+ 3
- 3
src/platformSpecific.android.js View File

44
   NativeReactModule.setScreenTitleBarSubtitle(screenInstanceID, subtitle);
44
   NativeReactModule.setScreenTitleBarSubtitle(screenInstanceID, subtitle);
45
 }
45
 }
46
 
46
 
47
-function setScreenTitleBarButtons(screenInstanceID, navigatorEventID, rightButtons, leftButton) {
48
-  NativeReactModule.setScreenTitleBarButtons(screenInstanceID, navigatorEventID, rightButtons, leftButton);
47
+function setScreenButtons(screenInstanceID, navigatorEventID, rightButtons, leftButton, fab) {
48
+  NativeReactModule.setScreenButtons(screenInstanceID, navigatorEventID, rightButtons, leftButton, fab);
49
 }
49
 }
50
 
50
 
51
 function showModal(screenParams) {
51
 function showModal(screenParams) {
141
   toggleBottomTabsVisible,
141
   toggleBottomTabsVisible,
142
   setScreenTitleBarTitle,
142
   setScreenTitleBarTitle,
143
   setScreenTitleBarSubtitle,
143
   setScreenTitleBarSubtitle,
144
-  setScreenTitleBarButtons,
144
+  setScreenButtons,
145
   showModal,
145
   showModal,
146
   dismissTopModal,
146
   dismissTopModal,
147
   dismissAllModals,
147
   dismissAllModals,