From 6d86ef9e410d661dfa3d57866dd018111e761c4f Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 8 Aug 2024 13:38:17 +0200 Subject: [PATCH] fix RBR of BottomTabBar inbox --- .../createCustomBottomTabNavigator/BottomTabBar.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx index b20094114383..faaf473efaa9 100644 --- a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx @@ -1,5 +1,5 @@ import {useNavigation} from '@react-navigation/native'; -import React, {memo, useCallback, useEffect} from 'react'; +import React, {memo, useCallback, useEffect, useState} from 'react'; import {NativeModules, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Icon from '@components/Icon'; @@ -17,6 +17,7 @@ import getAdaptedStateFromPath from '@libs/Navigation/linkingConfig/getAdaptedSt import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; import type {RootStackParamList, State} from '@libs/Navigation/types'; import {isCentralPaneName} from '@libs/NavigationUtils'; +import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; import {getChatTabBrickRoad} from '@libs/WorkspacesSettingsUtils'; import BottomTabAvatar from '@pages/home/sidebar/BottomTabAvatar'; import BottomTabBarFloatingActionButton from '@pages/home/sidebar/BottomTabBarFloatingActionButton'; @@ -40,6 +41,12 @@ function BottomTabBar({selectedTab}: BottomTabBarProps) { const navigation = useNavigation(); const {activeWorkspaceID} = useActiveWorkspace(); const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP); + const transactionViolations = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); + const [chatTabBrickRoad, setChatTabBrickRoad] = useState(getChatTabBrickRoad(activeWorkspaceID)); + + useEffect(() => { + setChatTabBrickRoad(getChatTabBrickRoad(activeWorkspaceID)); + }, [activeWorkspaceID, transactionViolations]); useEffect(() => { const navigationState = navigation.getState() as State | undefined; @@ -66,7 +73,6 @@ function BottomTabBar({selectedTab}: BottomTabBarProps) { // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps }, [isLoadingApp]); - const chatTabBrickRoad = getChatTabBrickRoad(activeWorkspaceID); const navigateToChats = useCallback(() => { if (selectedTab === SCREENS.HOME) { return;