Browse Source

Perform popToRoot on stack associated with calling navigator

Guy Carmeli 7 years ago
parent
commit
db1b939ee7

+ 12
- 5
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java View File

@@ -392,12 +392,19 @@ public class BottomTabsLayout extends BaseLayout implements AHBottomNavigation.O
392 392
 
393 393
     @Override
394 394
     public void popToRoot(final ScreenParams params) {
395
-        getCurrentScreenStack().popToRoot(params.animateScreenTransitions, params.timestamp, new ScreenStack.OnScreenPop() {
395
+        performOnStack(params.getNavigatorId(), new Task<ScreenStack>() {
396 396
             @Override
397
-            public void onScreenPopAnimationEnd() {
398
-                setBottomTabsStyleFromCurrentScreen();
399
-                alignSnackbarContainerWithBottomTabs((LayoutParams) snackbarAndFabContainer.getLayoutParams(), params.styleParams);
400
-                EventBus.instance.post(new ScreenChangedEvent(getCurrentScreenStack().peek().getScreenParams()));
397
+            public void run(final ScreenStack stack) {
398
+                stack.popToRoot(params.animateScreenTransitions, params.timestamp, new ScreenStack.OnScreenPop() {
399
+                    @Override
400
+                    public void onScreenPopAnimationEnd() {
401
+                        if (isCurrentStack(stack)) {
402
+                            setBottomTabsStyleFromCurrentScreen();
403
+                            alignSnackbarContainerWithBottomTabs((LayoutParams) snackbarAndFabContainer.getLayoutParams(), params.styleParams);
404
+                            EventBus.instance.post(new ScreenChangedEvent(stack.peek().getScreenParams()));
405
+                        }
406
+                    }
407
+                });
401 408
             }
402 409
         });
403 410
     }