Skip to content

Commit

Permalink
nav [nfc]: Stop passing apparently-removed showIcon option to botto…
Browse files Browse the repository at this point in the history
…m tabs

This was quietly dropped in v5, it seems:
  https://reactnavigation.org/docs/4.x/bottom-tab-navigator/
  https://reactnavigation.org/docs/5.x/bottom-tab-navigator/

The icons are still shown in manual testing, thankfully.

While we're at it, make BottomTabBarOptions exact in types/ using a
TsFlower patch.
  • Loading branch information
chrisbobbe committed Apr 15, 2024
1 parent 4e645f4 commit 81192fa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/styles/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const bottomTabNavigatorConfig = (): {| tabBarOptions: BottomTabBarOption
// doesn't have something else for Android (yet):
// https://reactnative.dev/docs/platform#ispad-ios
showLabel: Platform.OS === 'ios' && Platform.isPad,
showIcon: true,

activeTintColor: BRAND_COLOR,
inactiveTintColor: 'gray',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export type BottomTabNavigationConfig<T = BottomTabBarOptions> = {
...
};

export type BottomTabBarOptions = {
export type BottomTabBarOptions = {|
keyboardHidesTabBar?: boolean,
activeTintColor?: string,
inactiveTintColor?: string,
Expand All @@ -163,8 +163,7 @@ export type BottomTabBarOptions = {
style?: $tsflower_subst$RN$Animated$WithAnimatedValue<
$tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>,
>,
...
};
|};

export type BottomTabBarProps<T = BottomTabBarOptions> = T & {
state: TabNavigationState<ParamListBase>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chris Bobbe <cbobbe@zulip.com>
Date: Thu, 11 Apr 2024 14:49:54 -0700
Subject: [irreducible] rnav: Make MaterialTopTabNavigationOptions exact
Subject: [irreducible] rnav: Make top and bottom tab-bar options exact

Maybe someday TypeScript will have exact object types.
---
.../bottom-tabs/lib/typescript/src/types.js.flow | 5 ++---
.../material-top-tabs/lib/typescript/src/types.js.flow | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow
index ed9343057..03dedb1d6 100644
--- types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow
+++ types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow
@@ -140,7 +140,7 @@ export type BottomTabNavigationConfig<T = BottomTabBarOptions> = {
...
};

-export type BottomTabBarOptions = {
+export type BottomTabBarOptions = {|
keyboardHidesTabBar?: boolean,
activeTintColor?: string,
inactiveTintColor?: string,
@@ -163,8 +163,7 @@ export type BottomTabBarOptions = {
style?: $tsflower_subst$RN$Animated$WithAnimatedValue<
$tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>,
>,
- ...
-};
+|};

export type BottomTabBarProps<T = BottomTabBarOptions> = T & {
state: TabNavigationState<ParamListBase>,
diff --git types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow
index 6e3b1b9e4..7abe20b5f 100644
--- types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow
Expand Down

0 comments on commit 81192fa

Please sign in to comment.