Pārlūkot izejas kodu

Handle back button visibility when switching tabs

Guy Carmeli 8 gadus atpakaļ
vecāks
revīzija
d99b82a641

+ 7
- 0
android/app/src/main/java/com/reactnativenavigation/activities/BottomTabActivity.java Parādīt failu

@@ -175,6 +175,13 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
175 175
         mContentFrame.addView(mScreenStacks.get(position), new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
176 176
         mCurrentStackPosition = position;
177 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 187
     private static class SetupTabsTask extends AsyncTask<Void, Void, Map<Screen, Drawable>> {