/* eslint-disable class-methods-use-this */
import React, { useContext } from 'react';
import { StyleSheet, Text } from 'react-native';
import {
uiKitMessage,
UiKitParserMessage,
uiKitModal,
UiKitParserModal,
BLOCK_CONTEXT
} from '@rocket.chat/ui-kit';
import Markdown from '../markdown';
import Button from '../Button';
import TextInput from '../TextInput';
import { useBlockContext, textParser } from './utils';
import { themes } from '../../constants/colors';
import sharedStyles from '../../views/Styles';
import { Divider } from './Divider';
import { Section } from './Section';
import { Actions } from './Actions';
import { Image } from './Image';
import { Select } from './Select';
import { Context } from './Context';
import { MultiSelect } from './MultiSelect';
import { Input } from './Input';
import { DatePicker } from './DatePicker';
import { Overflow } from './Overflow';
import { ThemeContext } from '../../theme';
const styles = StyleSheet.create({
input: {
marginBottom: 0
},
multiline: {
height: 130
},
button: {
marginBottom: 16
},
text: {
fontSize: 16,
lineHeight: 22,
textAlignVertical: 'center',
...sharedStyles.textRegular
}
});
const plainText = ({ text } = { text: '' }) => text;
class MessageParser extends UiKitParserMessage {
text({ text, type } = { text: '' }, context) {
const { theme } = useContext(ThemeContext);
if (type !== 'mrkdwn') {
return {text};
}
const isContext = context === BLOCK_CONTEXT.CONTEXT;
return (
);
}
button(element, context) {
const {
text, value, actionId, style
} = element;
const [{ loading }, action] = useBlockContext(element, context);
const { theme } = useContext(ThemeContext);
return (