2021-10-20 16:32:58 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { StyleSheet, Text } from 'react-native';
|
|
|
|
import { Strike as StrikeProps } from '@rocket.chat/message-parser';
|
|
|
|
|
|
|
|
import Bold from './Bold';
|
|
|
|
import Italic from './Italic';
|
|
|
|
import Plain from './Plain';
|
|
|
|
import Link from './Link';
|
|
|
|
|
|
|
|
interface IStrikeProps {
|
|
|
|
value: StrikeProps['value'];
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
text: {
|
|
|
|
textDecorationLine: 'line-through'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-25 17:20:09 +00:00
|
|
|
const Strike = ({ value }: IStrikeProps) => (
|
2021-10-20 16:32:58 +00:00
|
|
|
<Text style={styles.text}>
|
|
|
|
{value.map(block => {
|
|
|
|
switch (block.type) {
|
|
|
|
case 'LINK':
|
|
|
|
return <Link value={block.value} />;
|
|
|
|
case 'PLAIN_TEXT':
|
|
|
|
return <Plain value={block.value} />;
|
|
|
|
case 'BOLD':
|
|
|
|
return <Bold value={block.value} />;
|
|
|
|
case 'ITALIC':
|
|
|
|
return <Italic value={block.value} />;
|
2023-11-13 17:14:37 +00:00
|
|
|
case 'MENTION_CHANNEL':
|
|
|
|
return <Plain value={`#${block.value.value}`} />;
|
2021-10-20 16:32:58 +00:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
})}
|
|
|
|
</Text>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Strike;
|