signal-desktop/ts/components/UserText.tsx

21 lines
535 B
TypeScript
Raw Normal View History

2023-04-20 10:03:43 -07:00
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useMemo } from 'react';
2023-04-20 10:03:43 -07:00
import { Emojify } from './conversation/Emojify';
import { bidiIsolate } from '../util/unicodeBidi';
2023-04-20 10:03:43 -07:00
2025-03-26 12:35:32 -07:00
export type UserTextProps = Readonly<{
text: string;
}>;
export function UserText(props: UserTextProps): JSX.Element {
const normalizedText = useMemo(() => {
2025-03-26 12:35:32 -07:00
return bidiIsolate(props.text);
}, [props.text]);
2023-04-20 10:03:43 -07:00
return (
<span dir="auto">
<Emojify text={normalizedText} />
2023-04-20 10:03:43 -07:00
</span>
);
}