Skip to content

Commit 0e9ea8c

Browse files
Fix track tiles again (#13779)
1 parent 282efbb commit 0e9ea8c

5 files changed

Lines changed: 52 additions & 35 deletions

File tree

packages/mobile/src/components/lineup-tile/CollectionTileTrackList.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,7 @@ export const CollectionTileTrackList = (props: LineupTileTrackListProps) => {
167167
const overflowTrackCount = trackCount - DISPLAY_TRACK_COUNT
168168

169169
return (
170-
<Pressable
171-
onPress={() => {
172-
onPressWithPropagationBlock?.()
173-
onPress?.()
174-
}}
175-
>
170+
<Pressable onPressIn={onPressWithPropagationBlock} onPress={onPress}>
176171
{tracks.slice(0, DISPLAY_TRACK_COUNT).map((track, index) => (
177172
<TrackItem
178173
key={track.uid}

packages/mobile/src/components/lineup-tile/LineupTileAccessStatus.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,7 @@ export const LineupTileAccessStatus = ({
158158

159159
const blockTilePress = useTilePressBlock()
160160

161-
const handlePressWithBlock = useCallback(() => {
162-
blockTilePress?.()
163-
handlePress()
164-
}, [blockTilePress, handlePress])
161+
const handlePressWithBlock = useCallback(() => handlePress(), [handlePress])
165162

166163
const backgroundColor = isUSDCPurchase
167164
? color.special.lightGreen
@@ -184,7 +181,7 @@ export const LineupTileAccessStatus = ({
184181
}
185182

186183
return (
187-
<TouchableOpacity onPress={handlePressWithBlock}>
184+
<TouchableOpacity onPressIn={blockTilePress} onPress={handlePressWithBlock}>
188185
<Flex
189186
{...(hasStreamAccess || isUnlocking ? unlockedStyles : lockedStyles)}
190187
direction='row'

packages/mobile/src/components/lineup-tile/LineupTileActionButtons.tsx

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ID, AccessConditions } from '@audius/common/models'
44
import { isContentUSDCPurchaseGated } from '@audius/common/models'
55
import type { PurchaseableContentType } from '@audius/common/store'
66
import type { Nullable } from '@audius/common/utils'
7-
import { View } from 'react-native'
7+
import { TouchableOpacity, View } from 'react-native'
88

99
import {
1010
Flex,
@@ -102,10 +102,14 @@ export const LineupTileActionButtons = ({
102102
isUSDCEnabled && isContentUSDCPurchaseGated(streamConditions)
103103
const showPublishButton = isOwner && isUnlisted
104104

105+
// onPressIn fires on touch-down, so we block before Paper's tap completes.
106+
// Use direct onPress (not wrapWithBlock) - repost/favorite handlers run after
107+
// Lottie animation, too late for the current tap's 100ms check.
105108
const repostButton = (
106109
<RepostButton
107110
wrapperStyle={styles.button}
108-
onPress={wrapWithBlock(onPressRepost)}
111+
onPressIn={blockTilePress}
112+
onPress={onPressRepost}
109113
isActive={hasReposted}
110114
isDisabled={disabled}
111115
/>
@@ -114,38 +118,57 @@ export const LineupTileActionButtons = ({
114118
const favoriteButton = (
115119
<FavoriteButton
116120
wrapperStyle={styles.button}
117-
onPress={wrapWithBlock(onPressSave)}
121+
onPressIn={blockTilePress}
122+
onPress={onPressSave}
118123
isActive={hasSaved}
119124
isDisabled={disabled}
120125
/>
121126
)
122127

128+
// Wrap in RN TouchableOpacity so the tile doesn't stay depressed - RN touchables
129+
// let the Paper's RNGH tap properly receive the release and run onFinalize.
123130
const shareButton = (
124-
<IconButton
125-
color='subdued'
126-
icon={IconShare}
127-
disabled={disabled}
131+
<TouchableOpacity
132+
onPressIn={blockTilePress}
128133
onPress={wrapWithBlock(onPressShare)}
129-
aria-label={messages.shareButtonLabel}
130-
size='l'
131-
style={{
132-
padding: 0
133-
}}
134-
/>
134+
disabled={disabled}
135+
activeOpacity={0.7}
136+
style={styles.button}
137+
accessibilityLabel={messages.shareButtonLabel}
138+
accessibilityRole='button'
139+
>
140+
<IconButton
141+
color='subdued'
142+
icon={IconShare}
143+
disabled={disabled}
144+
aria-label={messages.shareButtonLabel}
145+
size='l'
146+
style={{ padding: 0 }}
147+
pointerEvents='none'
148+
/>
149+
</TouchableOpacity>
135150
)
136151

137152
const moreButton = (
138-
<IconButton
139-
color='subdued'
140-
icon={IconKebabHorizontal}
141-
disabled={disabled}
153+
<TouchableOpacity
154+
onPressIn={blockTilePress}
142155
onPress={wrapWithBlock(onPressOverflow)}
143-
aria-label={messages.overflowButtonLabel}
144-
size='l'
145-
style={{
146-
padding: 0
147-
}}
148-
/>
156+
disabled={disabled}
157+
activeOpacity={0.7}
158+
style={styles.button}
159+
accessibilityLabel={messages.overflowButtonLabel}
160+
accessibilityRole='button'
161+
>
162+
<IconButton
163+
color='subdued'
164+
icon={IconKebabHorizontal}
165+
disabled={disabled}
166+
aria-label={messages.overflowButtonLabel}
167+
size='l'
168+
style={{ padding: 0 }}
169+
pointerEvents='none'
170+
/>
171+
</TouchableOpacity>
149172
)
150173

151174
const editButton = (

packages/mobile/src/components/lineup-tile/LineupTileMetadata.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const LineupTileMetadata = ({
117117
...tileStyles.title,
118118
...(isPlaying ? tileStyles.titlePlaying : {})
119119
}}
120+
onPressIn={onPressWithPropagationBlock}
120121
onPress={handleTitlePress}
121122
>
122123
<Text
@@ -135,6 +136,7 @@ export const LineupTileMetadata = ({
135136
) : null}
136137
</TouchableOpacity>
137138
<TouchableOpacity
139+
onPressIn={onPressWithPropagationBlock}
138140
onPress={handlePressArtist}
139141
activeOpacity={0.7}
140142
style={{ alignSelf: 'flex-start' }}

packages/mobile/src/components/lineup-tile/VanityMetrics.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export const VanityMetric = (props: VanityMetricProps) => {
2222

2323
const handlePress = () => {
2424
if (onPress && !disabled) {
25-
blockTilePress?.()
2625
onPress()
2726
}
2827
}
2928

3029
return (
3130
<TouchableOpacity
31+
onPressIn={blockTilePress}
3232
onPress={handlePress}
3333
disabled={disabled}
3434
hitSlop={DEFAULT_HIT_SLOP}

0 commit comments

Comments
 (0)