Skip to content

Commit 785038d

Browse files
feat: Support more than 6 screens on Android
1 parent 3806377 commit 785038d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import com.google.android.material.navigation.NavigationBarView.LABEL_VISIBILITY
3535
import com.google.android.material.transition.platform.MaterialFadeThrough
3636

3737
class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
38-
private var bottomNavigation = BottomNavigationView(context)
38+
private var bottomNavigation = ExtendedBottomNavigationView(context)
3939
val layoutHolder = FrameLayout(context)
4040

4141
var onTabSelectedListener: ((key: String) -> Unit)? = null
@@ -456,11 +456,17 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
456456
// React Native opts out ouf Activity re-creation when configuration changes, this workarounds that.
457457
// We also opt-out of this recreation when custom styles are used.
458458
removeView(bottomNavigation)
459-
bottomNavigation = BottomNavigationView(context)
459+
bottomNavigation = ExtendedBottomNavigationView(context)
460460
addView(bottomNavigation)
461461
updateItems(items)
462462
setLabeled(this.labeled)
463463
this.selectedItem?.let { setSelectedItem(it) }
464464
uiModeConfiguration = newConfig?.uiMode ?: uiModeConfiguration
465465
}
466466
}
467+
468+
class ExtendedBottomNavigationView(context: Context) : BottomNavigationView(context) {
469+
override fun getMaxItemCount(): Int {
470+
return 1_000
471+
}
472+
}

packages/react-native-bottom-tabs/src/TabView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ interface Props<Route extends BaseRoute> {
162162
};
163163
}
164164

165-
const ANDROID_MAX_TABS = 6;
165+
const ANDROID_MAX_TABS = 1_000;
166166

167167
const TabView = <Route extends BaseRoute>({
168168
navigationState,

0 commit comments

Comments
 (0)