实时消息: 引用定位

dev/mobile
Lei OT 2 years ago
parent 65d8733af9
commit 9eb99340c7

@ -489,18 +489,19 @@ export const parseRenderMessageItem = (msg) => {
whatsapp_msg_type: msg.type,
statusCN: msgStatusRenderMappedCN[msg?.status || 'failed'],
statusTitle: msgStatusRenderMappedCN[msg?.status || 'failed'],
...((isEmpty(msg.context) && isEmpty(msg.reaction)) || msg.context?.forwarded === true || isEmpty(msg.messageorigin)
...((isEmpty(msg.context) && isEmpty(msg.reaction)) || msg.context?.forwarded === true // || isEmpty(msg.messageorigin)
? {}
: {
reply: {
/**
* reply: { message: msg.messageorigin, title: 'React from', titleColor: '#1ba784' }
*/
title: msg.messageorigin?.customerProfile?.name || 'me',
title: isEmpty(msg.messageorigin) ? '...' : msg.messageorigin?.customerProfile?.name || 'me',
...(typeof whatsappMsgTypeMapped[(msg?.messageorigin?.type || 'unsupported')]?.renderForReply === 'function'
? whatsappMsgTypeMapped[(msg?.messageorigin?.type || 'unsupported')].renderForReply(msg.messageorigin)
: {}),
titleColor: msg.messageorigin?.customerProfile?.name ? '#a791ff' : "#128c7e",
id: msg.context?.id || msg.reaction?.message_id,
},
origin: msg.context,
}),

@ -15,6 +15,14 @@ const MessagesList = ({ messages, handlePreview, reference, longListLoading, get
// const messagesEndRef = useRef(null);
const messageRefs = useRef([]);
const [focusMsg, setFocusMsg] = useState('');
useEffect(() => {
setTimeout(() => {
setFocusMsg('');
}, 3500);
return () => '';
}, [focusMsg])
const scrollToBottom = (force = false) => {
if (reference.current && (shouldScrollBottom || force)) {

Loading…
Cancel
Save