@@ -5,7 +5,7 @@ import { Box, Cover, TextIcon, useColorMode } from '@/design-system';
5
5
import { IS_IOS } from '@/env' ;
6
6
import { deviceUtils } from '@/utils' ;
7
7
import { AnimatedBlurView } from '@/__swaps__/screens/Swap/components/AnimatedBlurView' ;
8
- import { useBrowserContext } from './BrowserContext' ;
8
+ import { RAINBOW_HOME , useBrowserContext } from './BrowserContext' ;
9
9
import { TAB_VIEW_COLUMN_WIDTH } from './Dimensions' ;
10
10
import { TIMING_CONFIGS } from '../animations/animationConfigs' ;
11
11
@@ -28,7 +28,10 @@ export const CloseTabButton = ({ onPress, tabIndex }: { onPress: () => void; tab
28
28
const { animatedActiveTabIndex, tabStates, tabViewProgress, tabViewVisible } = useBrowserContext ( ) ;
29
29
const { isDarkMode } = useColorMode ( ) ;
30
30
31
- const multipleTabsOpen = React . useMemo ( ( ) => tabStates . length > 1 , [ tabStates . length ] ) ;
31
+ const multipleTabsOpen = tabStates . length > 1 ;
32
+ const tabUrl = tabStates [ tabIndex ] ?. url ;
33
+ const isOnHomepage = tabUrl === RAINBOW_HOME ;
34
+ const isEmptyState = ! multipleTabsOpen && isOnHomepage ;
32
35
const buttonSize = multipleTabsOpen ? SCALE_ADJUSTED_X_BUTTON_SIZE : SCALE_ADJUSTED_X_BUTTON_SIZE_SINGLE_TAB ;
33
36
const buttonPadding = multipleTabsOpen ? SCALE_ADJUSTED_X_BUTTON_PADDING : SCALE_ADJUSTED_X_BUTTON_PADDING_SINGLE_TAB ;
34
37
@@ -40,13 +43,13 @@ export const CloseTabButton = ({ onPress, tabIndex }: { onPress: () => void; tab
40
43
// entered. This is mainly to avoid showing the close button in the
41
44
// active tab until the tab view animation is near complete.
42
45
const interpolatedOpacity = interpolate ( progress , [ 0 , 80 , 100 ] , [ isActiveTab ? 0 : 1 , isActiveTab ? 0 : 1 , 1 ] ) ;
43
- const opacity = tabViewVisible ?. value || ! isActiveTab ? interpolatedOpacity : withTiming ( 0 , TIMING_CONFIGS . fastFadeConfig ) ;
44
-
46
+ const opacity =
47
+ ! isEmptyState && ( tabViewVisible ?. value || ! isActiveTab ) ? interpolatedOpacity : withTiming ( 0 , TIMING_CONFIGS . fastFadeConfig ) ;
45
48
return { opacity } ;
46
49
} ) ;
47
50
48
51
const pointerEventsStyle = useAnimatedStyle ( ( ) => {
49
- const pointerEvents = tabViewVisible ?. value ? 'auto' : 'none' ;
52
+ const pointerEvents = tabViewVisible ?. value && ! isEmptyState ? 'auto' : 'none' ;
50
53
return { pointerEvents } ;
51
54
} ) ;
52
55
0 commit comments