change approach for keeping tab highlit

This commit is contained in:
Samuel Newman
2026-04-17 21:01:00 +03:00
parent c76e7eb9b9
commit f0e59a4333
2 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -46,7 +46,11 @@ export function isTab(current: string, route: string) {
// our tab routes can be variously referenced by 3 different names
// this helper deals with that weirdness
// -prf
return current.startsWith(route)
return (
current === route ||
current === `${route}Tab` ||
current === `${route}Inner`
)
}
export enum TabState {
+3 -1
View File
@@ -306,6 +306,7 @@ function SwitcherMenuProfileLink() {
return isTab(currentRouteInfo.name, pathName)
}
}, [currentAccount?.handle, currentRouteInfo, pathName])
const onProfilePress = useCallback(
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
if (e.ctrlKey || e.metaKey || e.altKey) {
@@ -411,6 +412,7 @@ function NavItem({
(currentRouteInfo.params as CommonNavigatorParams['Profile']).name ===
currentAccount?.handle
: isTab(currentRouteInfo.name, pathName)
const isRelated = currentRouteInfo.name.startsWith(pathName)
const navigation = useNavigation<NavigationProp>()
const onPressWrapped = useCallback(
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
@@ -461,7 +463,7 @@ function NavItem({
height: 30,
},
]}>
{isCurrent ? iconFilled : icon}
{isCurrent || isRelated ? iconFilled : icon}
{typeof count === 'string' && count ? (
<View
style={[