Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/giant-years-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-native-bottom-tabs": patch
---

feat: support more than 6 screens on Android
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ import com.google.android.material.navigation.NavigationBarView.LABEL_VISIBILITY
import com.google.android.material.navigation.NavigationBarView.LABEL_VISIBILITY_UNLABELED
import com.google.android.material.transition.platform.MaterialFadeThrough

class ExtendedBottomNavigationView(context: Context) : BottomNavigationView(context) {
override fun getMaxItemCount(): Int {
return 100
}
}

class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
private var bottomNavigation = BottomNavigationView(context)
private var bottomNavigation = ExtendedBottomNavigationView(context)
val layoutHolder = FrameLayout(context)

var onTabSelectedListener: ((key: String) -> Unit)? = null
Expand Down Expand Up @@ -456,7 +462,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
// React Native opts out ouf Activity re-creation when configuration changes, this workarounds that.
// We also opt-out of this recreation when custom styles are used.
removeView(bottomNavigation)
bottomNavigation = BottomNavigationView(context)
bottomNavigation = ExtendedBottomNavigationView(context)
addView(bottomNavigation)
updateItems(items)
setLabeled(this.labeled)
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-bottom-tabs/src/TabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
};
}

const ANDROID_MAX_TABS = 6;
const ANDROID_MAX_TABS = 100;

const TabView = <Route extends BaseRoute>({
navigationState,
Expand Down Expand Up @@ -220,7 +220,7 @@

if (!loaded.includes(focusedKey)) {
// Set the current tab to be loaded if it was not loaded before
setLoaded((loaded) => [...loaded, focusedKey]);

Check warning on line 223 in packages/react-native-bottom-tabs/src/TabView.tsx

View workflow job for this annotation

GitHub Actions / lint

'loaded' is already declared in the upper scope on line 219 column 10
}

const icons = React.useMemo(
Expand Down
Loading