import React, { useState, useCallback } from 'react'; import { StyleSheet } from 'react-native'; import { Select, SelectElement, SelectProps, SelectItem, SelectGroup, } from '@ui-kitten/components'; import { SelectOptionType } from './type'; interface SelectCustomProps extends SelectProps { data: SelectOptionType[]; multiSelect?: boolean; groupedOptions?: boolean; } export const MultiselectShowcase = ( props: SelectCustomProps ): SelectElement => { const [selectedIndex, setSelectedIndex] = useState(props.selectedIndex); const renderOption = useCallback( (item, index) => , [] ); const renderGroup = useCallback( (item, index) => ( {item.items.map(renderOption)} ), [] ); const multipleValues = selectedIndex && selectedIndex instanceof Array ? selectedIndex .map((index) => { return props.data[index.section]?.items[index.row].title; }) .join(', ') : null; const displayValue = () => (props.groupedOptions ? multipleValues : null); return ( <> ); }; const styles = StyleSheet.create({ select: { width: 200, }, });