import React from 'react';
import { FlatList, Text } from 'react-native';
import Touchable from 'react-native-platform-touchable';
import FastImage from '@rocket.chat/react-native-fast-image';
import Check from '../../Check';
import * as List from '../../List';
import { textParser } from '../utils';
import { themes } from '../../../lib/constants';
import styles from './styles';
import { IItemData } from '.';
import { TSupportedThemes } from '../../../theme';
interface IItem {
item: IItemData;
selected?: string;
onSelect: Function;
theme: TSupportedThemes;
}
interface IItems {
items: IItemData[];
selected: string[];
onSelect: Function;
theme: TSupportedThemes;
}
const keyExtractor = (item: IItemData) => item.value.toString();
// RectButton doesn't work on modal (Android)
const Item = ({ item, selected, onSelect, theme }: IItem) => {
const itemName = item.value?.name || item.text.text.toLowerCase();
return (
onSelect(item)}
style={[styles.item, { backgroundColor: themes[theme].backgroundColor }]}>
<>
{item.imageUrl ? : null}
{textParser([item.text])}
{selected ? : null}
>
);
};
const Items = ({ items, selected, onSelect, theme }: IItems) => (
(
- s === item.value)} />
)}
/>
);
export default Items;