/* eslint-disable class-methods-use-this */ import React, { useContext } from 'react'; import { StyleSheet, Text } from 'react-native'; import { BLOCK_CONTEXT, UiKitParserMessage, UiKitParserModal, uiKitMessage, uiKitModal } from '@rocket.chat/ui-kit'; import Markdown, { MarkdownPreview } from '../markdown'; import Button from '../Button'; import TextInput from '../TextInput'; import { textParser, useBlockContext } from './utils'; import { themes } from '../../lib/constants'; 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'; import { BlockContext, IActions, IButton, IElement, IInputIndex, IParser, ISection, IText } from './interfaces'; 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 { get current() { return this as unknown as IParser; } text({ text, type }: Partial = { text: '' }, context: BlockContext) { const { theme } = useContext(ThemeContext); if (type !== 'mrkdwn') { return {text}; } const isContext = context === BLOCK_CONTEXT.CONTEXT; if (isContext) { return ; } return ; } button(element: IButton, context: BlockContext) { const { text, value, actionId, style } = element; const [{ loading }, action] = useBlockContext(element, context); const { theme } = useContext(ThemeContext); return (