Don't toggle the date divider when tapping a reaction (#10274)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import {memo, useCallback, useEffect, useMemo} from 'react'
|
import {memo, useCallback, useEffect, useMemo, useRef} from 'react'
|
||||||
import {
|
import {
|
||||||
type GestureResponderEvent,
|
type GestureResponderEvent,
|
||||||
LayoutAnimation,
|
LayoutAnimation,
|
||||||
@@ -106,6 +106,7 @@ let MessageItem = ({
|
|||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
const reactionsControl = useDialogControl()
|
const reactionsControl = useDialogControl()
|
||||||
|
const reactionTapRef = useRef(false)
|
||||||
|
|
||||||
const {message, nextMessage, prevMessage} = item
|
const {message, nextMessage, prevMessage} = item
|
||||||
const isPending = item.type === 'pending-message'
|
const isPending = item.type === 'pending-message'
|
||||||
@@ -328,6 +329,16 @@ let MessageItem = ({
|
|||||||
transform: [{translateY: -8}],
|
transform: [{translateY: -8}],
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
onPressIn={() => {
|
||||||
|
// Don't toggle the date divider when tapping a reaction.
|
||||||
|
reactionTapRef.current = true
|
||||||
|
}}
|
||||||
|
onPressOut={() => {
|
||||||
|
// Include a delay here to account for tap-and-drag before release.
|
||||||
|
setTimeout(() => {
|
||||||
|
reactionTapRef.current = false
|
||||||
|
}, 100)
|
||||||
|
}}
|
||||||
onPress={() => (isGroupChat ? reactionsControl.open() : undefined)}>
|
onPress={() => (isGroupChat ? reactionsControl.open() : undefined)}>
|
||||||
{groupedReactions.map(group => (
|
{groupedReactions.map(group => (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
@@ -427,6 +438,7 @@ let MessageItem = ({
|
|||||||
isFromSelf={isFromSelf}
|
isFromSelf={isFromSelf}
|
||||||
message={message}
|
message={message}
|
||||||
onTap={() => {
|
onTap={() => {
|
||||||
|
if (reactionTapRef.current) return
|
||||||
if (!hasLargeGapFromPrev) {
|
if (!hasLargeGapFromPrev) {
|
||||||
LayoutAnimation.configureNext(
|
LayoutAnimation.configureNext(
|
||||||
LayoutAnimation.Presets.easeInEaseOut,
|
LayoutAnimation.Presets.easeInEaseOut,
|
||||||
|
|||||||
Reference in New Issue
Block a user