mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-13 22:30:41 +08:00
Fix showing sw back button on nested stack on Android. (#308)
This change fixes a problem with native stack on Android where we'd display a sw back button on screens that are nested stack navigatodespite the fact those screens were the initial screens in the whole container stack. In #306 we introuced a change that would allow for displaying sw back in nested stacks, however that change did not handle the case where screen is a root screen of a container that is nested and placed as an initial screen in another container.
This commit is contained in:
committed by
GitHub
parent
acb038e213
commit
06b928f5c1
@@ -139,9 +139,6 @@ public class ScreenStackHeaderConfig extends ViewGroup {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isRoot = stack == null ? true : stack.getRootScreen() == parent;
|
||||
boolean isNested = (parent.getFragment().getParentFragment() instanceof ScreenStackFragment);
|
||||
|
||||
if (mToolbar.getParent() == null) {
|
||||
getScreenFragment().setToolbar(mToolbar);
|
||||
}
|
||||
@@ -151,7 +148,7 @@ public class ScreenStackHeaderConfig extends ViewGroup {
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
|
||||
// hide back button
|
||||
actionBar.setDisplayHomeAsUpEnabled((isRoot && !isNested) ? false : !mIsBackButtonHidden);
|
||||
actionBar.setDisplayHomeAsUpEnabled(getScreenFragment().canNavigateBack() ? !mIsBackButtonHidden : false);
|
||||
|
||||
// when setSupportActionBar is called a toolbar wrapper gets initialized that overwrites
|
||||
// navigation click listener. The default behavior set in the wrapper is to call into
|
||||
|
||||
Reference in New Issue
Block a user