2023-04-20 10:03:43 -07:00
|
|
|
// Copyright 2023 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
2024-04-03 15:41:13 -07:00
|
|
|
import React, { useMemo } from 'react';
|
2023-04-20 10:03:43 -07:00
|
|
|
import { Emojify } from './conversation/Emojify';
|
2024-04-03 15:41:13 -07:00
|
|
|
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 {
|
2024-04-03 15:41:13 -07:00
|
|
|
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">
|
2024-04-03 15:41:13 -07:00
|
|
|
<Emojify text={normalizedText} />
|
2023-04-20 10:03:43 -07:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|