From 785038d8a95aa8b0dace9a6b539884ebc9cd944f Mon Sep 17 00:00:00 2001 From: sidorchukandrew <36050911+sidorchukandrew@users.noreply.github.com> Date: Fri, 11 Apr 2025 14:12:38 -0400 Subject: [PATCH 1/4] feat: Support more than 6 screens on Android --- .../android/src/main/java/com/rcttabview/RCTTabView.kt | 10 ++++++++-- packages/react-native-bottom-tabs/src/TabView.tsx | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt index 7ed9d535..a30a87d3 100644 --- a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt +++ b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt @@ -35,7 +35,7 @@ import com.google.android.material.navigation.NavigationBarView.LABEL_VISIBILITY import com.google.android.material.transition.platform.MaterialFadeThrough 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 @@ -456,7 +456,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) @@ -464,3 +464,9 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) { uiModeConfiguration = newConfig?.uiMode ?: uiModeConfiguration } } + +class ExtendedBottomNavigationView(context: Context) : BottomNavigationView(context) { + override fun getMaxItemCount(): Int { + return 1_000 + } +} diff --git a/packages/react-native-bottom-tabs/src/TabView.tsx b/packages/react-native-bottom-tabs/src/TabView.tsx index 3854669c..bfa37585 100644 --- a/packages/react-native-bottom-tabs/src/TabView.tsx +++ b/packages/react-native-bottom-tabs/src/TabView.tsx @@ -162,7 +162,7 @@ interface Props { }; } -const ANDROID_MAX_TABS = 6; +const ANDROID_MAX_TABS = 1_000; const TabView = ({ navigationState, From 5e3f2bd662de0206992a65e487759e82d850123e Mon Sep 17 00:00:00 2001 From: sidorchukandrew <36050911+sidorchukandrew@users.noreply.github.com> Date: Sat, 12 Apr 2025 22:24:42 -0400 Subject: [PATCH 2/4] Move class definition to top --- .../src/main/java/com/rcttabview/RCTTabView.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt index a30a87d3..31217460 100644 --- a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt +++ b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt @@ -34,6 +34,12 @@ 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 1_000 + } +} + class ReactBottomNavigationView(context: Context) : LinearLayout(context) { private var bottomNavigation = ExtendedBottomNavigationView(context) val layoutHolder = FrameLayout(context) @@ -464,9 +470,3 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) { uiModeConfiguration = newConfig?.uiMode ?: uiModeConfiguration } } - -class ExtendedBottomNavigationView(context: Context) : BottomNavigationView(context) { - override fun getMaxItemCount(): Int { - return 1_000 - } -} From c0c3bdf70881eb7e8472a028ac135c76cf3687e9 Mon Sep 17 00:00:00 2001 From: sidorchukandrew <36050911+sidorchukandrew@users.noreply.github.com> Date: Sat, 12 Apr 2025 22:25:03 -0400 Subject: [PATCH 3/4] Make max Android screens 100 instead --- .../android/src/main/java/com/rcttabview/RCTTabView.kt | 2 +- packages/react-native-bottom-tabs/src/TabView.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt index 31217460..390579ed 100644 --- a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt +++ b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt @@ -36,7 +36,7 @@ import com.google.android.material.transition.platform.MaterialFadeThrough class ExtendedBottomNavigationView(context: Context) : BottomNavigationView(context) { override fun getMaxItemCount(): Int { - return 1_000 + return 100 } } diff --git a/packages/react-native-bottom-tabs/src/TabView.tsx b/packages/react-native-bottom-tabs/src/TabView.tsx index bfa37585..9332c7d7 100644 --- a/packages/react-native-bottom-tabs/src/TabView.tsx +++ b/packages/react-native-bottom-tabs/src/TabView.tsx @@ -162,7 +162,7 @@ interface Props { }; } -const ANDROID_MAX_TABS = 1_000; +const ANDROID_MAX_TABS = 100; const TabView = ({ navigationState, From 9dae61374bde11f3ddab706a46a85abd07ee67d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwa=C5=9Bniewski?= Date: Mon, 14 Apr 2025 21:05:32 +0200 Subject: [PATCH 4/4] Create giant-years-turn.md --- .changeset/giant-years-turn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/giant-years-turn.md diff --git a/.changeset/giant-years-turn.md b/.changeset/giant-years-turn.md new file mode 100644 index 00000000..9dc9ad5e --- /dev/null +++ b/.changeset/giant-years-turn.md @@ -0,0 +1,5 @@ +--- +"react-native-bottom-tabs": patch +--- + +feat: support more than 6 screens on Android