38 lines
806 B
JavaScript
38 lines
806 B
JavaScript
/* eslint-disable react/no-array-index-key */
|
|
import React from 'react';
|
|
import { StyleSheet, Text } from 'react-native';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Plain from './Plain';
|
|
import Bold from './Bold';
|
|
import Italic from './Italic';
|
|
|
|
const styles = StyleSheet.create({
|
|
text: {
|
|
textDecorationLine: 'line-through'
|
|
}
|
|
});
|
|
|
|
const Strike = ({ value }) => (
|
|
<Text style={styles.text}>
|
|
{value.map((block, index) => {
|
|
switch (block.type) {
|
|
case 'PLAIN_TEXT':
|
|
return <Plain key={index} value={block.value} />;
|
|
case 'BOLD':
|
|
return <Bold key={index} value={block.value} />;
|
|
case 'ITALIC':
|
|
return <Italic key={index} value={block.value} />;
|
|
default:
|
|
return null;
|
|
}
|
|
})}
|
|
</Text>
|
|
);
|
|
|
|
Strike.propTypes = {
|
|
value: PropTypes.string
|
|
};
|
|
|
|
export default Strike;
|