import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit'; import { themes } from '../../constants/colors'; import { IAccessoryComponent, IFields, ISection } from './interfaces'; import { useTheme } from '../../theme'; const styles = StyleSheet.create({ content: { marginBottom: 8 }, row: { flexDirection: 'row' }, column: { justifyContent: 'center' }, text: { flex: 1, padding: 4 }, field: { marginVertical: 6 } }); const Accessory = ({ element, parser }: IAccessoryComponent) => parser.renderAccessories({ ...element }, BLOCK_CONTEXT.SECTION, parser); const Fields = ({ fields, parser, theme }: IFields) => ( <> {fields.map(field => ( {parser.text(field)} ))} ); const accessoriesRight = ['image', 'overflow']; export const Section = ({ blockId, appId, text, fields, accessory, parser }: ISection) => { const { theme } = useTheme(); return ( {text ? {parser.text(text)} : null} {fields ? : null} {accessory ? : null} ); };