verdnatura-chat/app/containers/markdown/new/CodeLine.tsx

22 lines
564 B
TypeScript
Raw Normal View History

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