You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/components/conversation/ReadableMessage.tsx

30 lines
642 B
TypeScript

4 years ago
import React from 'react';
4 years ago
import { useFocus } from '../../hooks/useFocus';
import { InView } from 'react-intersection-observer';
4 years ago
type ReadableMessageProps = {
4 years ago
children: React.ReactNode;
messageId: string;
4 years ago
className: string;
onChange: (inView: boolean) => void;
onContextMenu: (e: any) => void;
};
4 years ago
export const ReadableMessage = (props: ReadableMessageProps) => {
const { onChange, messageId } = props;
4 years ago
useFocus(onChange);
4 years ago
4 years ago
return (
<InView
id={`msg-${messageId}`}
{...props}
as="div"
threshold={0.5}
delay={100}
triggerOnce={false}
>
4 years ago
{props.children}
</InView>
);
};