signal-desktop/ts/components/UserText.tsx

17 lines
469 B
TypeScript
Raw Normal View History

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