Skip to content

Commit 9404d65

Browse files
authored
Fix now playing drawer navigation (#13832)
1 parent 6931d00 commit 9404d65

8 files changed

Lines changed: 17 additions & 15 deletions

File tree

packages/mobile/src/components/now-playing-drawer/TrackInfo.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useSelector } from 'react-redux'
99

1010
import { LockedStatusBadge, Text } from 'app/components/core'
1111
import { useDrawer } from 'app/hooks/useDrawer'
12-
import { useNavigation } from 'app/hooks/useNavigation'
12+
import { useAppTabNavigation } from 'app/screens/app-screen'
1313
import { makeStyles } from 'app/styles'
1414
import type { GestureResponderHandler } from 'app/types/gesture'
1515

@@ -51,7 +51,7 @@ export const TrackInfo = (props: TrackInfoProps) => {
5151
const styles = useStyles()
5252
const { hasStreamAccess } = useGatedContentAccess(track)
5353
const { onClose } = useDrawer('NowPlaying')
54-
const navigation = useNavigation()
54+
const navigation = useAppTabNavigation()
5555
const isPreviewing = useSelector(getPreviewing)
5656
const shouldShowPreviewLock =
5757
isPreviewing ||
@@ -60,8 +60,10 @@ export const TrackInfo = (props: TrackInfoProps) => {
6060
!hasStreamAccess)
6161

6262
const handlePressArtist = useCallback(() => {
63-
onClose()
64-
navigation?.push('Profile', { id: user?.user_id })
63+
if (user?.user_id) {
64+
onClose()
65+
navigation?.push('Profile', { id: user.user_id })
66+
}
6567
}, [navigation, user?.user_id, onClose])
6668

6769
if (!user || !track) return null
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export * from './AppDrawerScreen'
22
export * from './AppDrawerContext'
3-
export * from './useAppDrawerNavigation'

packages/mobile/src/screens/app-drawer-screen/left-nav-drawer/AccountDetails.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { TouchableOpacity } from 'react-native'
66
import { Flex, Text } from '@audius/harmony-native'
77
import { ProfilePicture } from 'app/components/core'
88
import { UserLink } from 'app/components/user-link'
9+
import { useAppTabNavigation } from 'app/screens/app-screen'
910

1011
import { AppDrawerContext } from '../AppDrawerContext'
11-
import { useAppDrawerNavigation } from '../useAppDrawerNavigation'
1212

1313
export const AccountDetails = () => {
1414
const { drawerHelpers } = useContext(AppDrawerContext)
@@ -20,7 +20,7 @@ export const AccountDetails = () => {
2020
})
2121
const { handle, user_id } = accountUser ?? {}
2222

23-
const navigation = useAppDrawerNavigation()
23+
const navigation = useAppTabNavigation()
2424

2525
const handlePressAccount = useCallback(() => {
2626
if (handle) {

packages/mobile/src/screens/app-drawer-screen/left-nav-drawer/LeftNavLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import type { IconComponent } from '@audius/harmony-native'
88
import type { TextProps } from 'app/components/core'
99
import type { ContextualParams } from 'app/hooks/useNavigation'
1010
import type { AppTabScreenParamList } from 'app/screens/app-screen'
11+
import { useAppTabNavigation } from 'app/screens/app-screen'
1112
import { makeStyles } from 'app/styles'
1213
import { useThemeColors } from 'app/utils/theme'
1314

1415
import { AppDrawerContext } from '../AppDrawerContext'
15-
import { useAppDrawerNavigation } from '../useAppDrawerNavigation'
1616

1717
const useStyles = makeStyles(({ spacing, palette }) => ({
1818
accountListItem: {
@@ -61,7 +61,7 @@ export const LeftNavLink = <Screen extends keyof AppTabScreenParamList>(
6161
} = props
6262
const styles = useStyles()
6363
const { neutral } = useThemeColors()
64-
const navigation = useAppDrawerNavigation()
64+
const navigation = useAppTabNavigation()
6565
const { drawerHelpers } = useContext(AppDrawerContext)
6666

6767
const handlePress = useCallback(() => {

packages/mobile/src/screens/app-drawer-screen/left-nav-drawer/VanityMetrics.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { TouchableOpacity } from 'react-native-gesture-handler'
1010
import { useDispatch } from 'react-redux'
1111

1212
import { Divider, Flex, Text } from '@audius/harmony-native'
13+
import { useAppTabNavigation } from 'app/screens/app-screen'
1314
import { makeStyles } from 'app/styles'
1415
import { spacing } from 'app/styles/spacing'
1516

1617
import { AppDrawerContext } from '../AppDrawerContext'
17-
import { useAppDrawerNavigation } from '../useAppDrawerNavigation'
1818

1919
const { setFollowers } = followersUserListActions
2020
const { setFollowing } = followingUserListActions
@@ -77,7 +77,7 @@ export const VanityMetrics = () => {
7777
const { user_id, followee_count = 0, follower_count = 0 } = accountUser ?? {}
7878

7979
const dispatch = useDispatch()
80-
const navigation = useAppDrawerNavigation()
80+
const navigation = useAppTabNavigation()
8181
const { drawerHelpers } = useContext(AppDrawerContext)
8282

8383
const handlePressFollowing = useCallback(() => {

packages/mobile/src/screens/app-screen/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './AppTabsScreen'
33
export * from './AppTabScreen'
44
export * from './TopBarIconButton'
55
export * from './AppTabNavigationProvider'
6+
export * from './useAppTabNavigation'

packages/mobile/src/screens/app-drawer-screen/useAppDrawerNavigation.ts renamed to packages/mobile/src/screens/app-screen/useAppTabNavigation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { useContext } from 'react'
22

33
import { useNavigation } from 'app/hooks/useNavigation'
44

5-
import { AppTabNavigationContext } from '../app-screen'
5+
import { AppTabNavigationContext } from './AppTabNavigationProvider'
66

7-
export const useAppDrawerNavigation = () => {
7+
export const useAppTabNavigation = () => {
88
const { navigation: contextNavigation } = useContext(AppTabNavigationContext)
99
return useNavigation({ customNavigation: contextNavigation })
1010
}

packages/mobile/src/screens/chat-screen/ChatBlastCTA.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { KeyboardAvoidingView } from 'app/components/core'
1717
import { PLAY_BAR_HEIGHT } from 'app/components/now-playing-drawer/constants'
1818
import { make, track } from 'app/services/analytics'
1919

20-
import { useAppDrawerNavigation } from '../app-drawer-screen'
20+
import { useAppTabNavigation } from '../app-screen'
2121

2222
import { useKeyboardAvoidingPlaybarStyle } from './hooks/useKeyboardAvoidingPlaybarStyle'
2323

@@ -33,7 +33,7 @@ const messages = {
3333
}
3434

3535
export const ChatBlastCTA = () => {
36-
const navigation = useAppDrawerNavigation()
36+
const navigation = useAppTabNavigation()
3737
const keyboardAvoidingPlaybarStyle = useKeyboardAvoidingPlaybarStyle()
3838
const hasCurrentlyPlayingTrack = useSelector(getHasTrack)
3939

0 commit comments

Comments
 (0)