Browse Source

Handle back button visibility when switching tabs

Guy Carmeli 8 years ago
parent
commit
d99b82a641

+ 7
- 0
android/app/src/main/java/com/reactnativenavigation/activities/BottomTabActivity.java View File

175
         mContentFrame.addView(mScreenStacks.get(position), new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
175
         mContentFrame.addView(mScreenStacks.get(position), new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
176
         mCurrentStackPosition = position;
176
         mCurrentStackPosition = position;
177
         StyleHelper.updateStyles(mToolbar, getCurrentScreen());
177
         StyleHelper.updateStyles(mToolbar, getCurrentScreen());
178
+
179
+        // Hide or show back button if needed
180
+        if (getScreenStackSize() > 1) {
181
+            mToolbar.showBackButton(getCurrentScreen());
182
+        } else {
183
+            mToolbar.hideBackButton();
184
+        }
178
     }
185
     }
179
 
186
 
180
     private static class SetupTabsTask extends AsyncTask<Void, Void, Map<Screen, Drawable>> {
187
     private static class SetupTabsTask extends AsyncTask<Void, Void, Map<Screen, Drawable>> {