Fix profile load issue + enhancement of profile isCurrent style (#764)
* fix profile isActive issue * fix myProfile load issue when visiting other profiles first * fix lint issues * change currentRouteName to currentRouteInfozio/stable
parent
5d0a3e6c65
commit
442d453600
|
@ -47,6 +47,10 @@ export const ProfileScreen = withAuthRequired(
|
|||
)
|
||||
useSetTitle(combinedDisplayName(uiState.profile))
|
||||
|
||||
useEffect(() => {
|
||||
setHasSetup(false)
|
||||
}, [route.params.name])
|
||||
|
||||
useFocusEffect(
|
||||
React.useCallback(() => {
|
||||
let aborted = false
|
||||
|
|
|
@ -91,14 +91,17 @@ const NavItem = observer(
|
|||
const pal = usePalette('default')
|
||||
const store = useStores()
|
||||
const [pathName] = React.useMemo(() => router.matchPath(href), [href])
|
||||
const currentRouteName = useNavigationState(state => {
|
||||
const currentRouteInfo = useNavigationState(state => {
|
||||
if (!state) {
|
||||
return 'Home'
|
||||
return {name: 'Home'}
|
||||
}
|
||||
return getCurrentRoute(state).name
|
||||
return getCurrentRoute(state)
|
||||
})
|
||||
|
||||
const isCurrent = isTab(currentRouteName, pathName)
|
||||
let isCurrent =
|
||||
currentRouteInfo.name === 'Profile'
|
||||
? isTab(currentRouteInfo.name, pathName) &&
|
||||
currentRouteInfo.params.name === store.me.handle
|
||||
: isTab(currentRouteInfo.name, pathName)
|
||||
const {onPress} = useLinkProps({to: href})
|
||||
const onPressWrapped = React.useCallback(
|
||||
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
||||
|
|
Loading…
Reference in New Issue