2022-07-20 21:02:18 +00:00
|
|
|
import { CodeLine as CodeLineProps } from '@rocket.chat/message-parser';
|
2021-10-20 16:32:58 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Text } from 'react-native';
|
2022-07-20 21:02:18 +00:00
|
|
|
|
|
|
|
import { useTheme } from '../../../theme';
|
|
|
|
import styles from '../styles';
|
2021-10-20 16:32:58 +00:00
|
|
|
|
|
|
|
interface ICodeLineProps {
|
|
|
|
value: CodeLineProps['value'];
|
|
|
|
}
|
|
|
|
|
2022-07-20 21:02:18 +00:00
|
|
|
const CodeLine = ({ value }: ICodeLineProps): React.ReactElement | null => {
|
|
|
|
const { colors } = useTheme();
|
2021-10-20 16:32:58 +00:00
|
|
|
if (value.type !== 'PLAIN_TEXT') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-07-20 21:02:18 +00:00
|
|
|
return <Text style={[styles.codeBlockText, { color: colors.bodyText }]}>{value.value}</Text>;
|
2021-10-20 16:32:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default CodeLine;
|