verdnatura-chat/app/containers/markdown/MessageBody/InlineCode.js

34 lines
770 B
JavaScript
Raw Normal View History

import React from 'react';
import { Text } from 'react-native';
import PropTypes from 'prop-types';
import styles from '../styles';
import { themes } from '../../../constants/colors';
2021-08-20 16:25:30 +00:00
import { useTheme } from '../../../theme';
const InlineCode = ({ value, style }) => {
const { theme } = useTheme();
2021-08-20 16:25:30 +00:00
console.log({ value: value.value });
return (
<Text style={[
{
...styles.codeInline,
color: themes[theme].bodyText,
backgroundColor: themes[theme].bannerBackground,
2021-08-20 16:25:30 +00:00
borderColor: themes[theme].borderColor
},
...style
]}
>
2021-08-20 16:25:30 +00:00
{value.type === 'PLAIN_TEXT' && value.value}
</Text>
);
};
InlineCode.propTypes = {
value: PropTypes.object,
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
};
export default InlineCode;