import React, { useRef } from 'react' import { View, Button, Text, ScrollView, TouchableOpacity } from 'react-native' import SectionedMultiSelect from 'react-native-sectioned-multi-select' import Icon from 'react-native-vector-icons/MaterialIcons' import { Colors } from 'react-native/Libraries/NewAppScreen' type ItemType = { title: string id: number } const items = [ { id: 1, title: 'Item 1 234234' }, { id: 2, title: 'Item 2 asdfsa' }, { id: 3, title: 'Item 3 asdf d' }, { id: 4, title: 'Item 4d a' } ] const App: React.FC = () => { const ref = useRef>() const [selectedItems, setSelectedItems] = React.useState([]) const removeAll = () => { ref.current?._removeAllItems() } const toggle = () => { ref.current?._toggleSelector() } console.log(selectedItems) return ( uniqueKey="id" displayKey="title" onSelectedItemsChange={setSelectedItems} selectedItems={selectedItems} items={items} ref={ref} customChipsRenderer={(props) => ( {selectedItems.map((itemId) => { const item = items.find(({ id }) => id === itemId) return ( {item.title} ref.current?._removeItem(item)} > ) })} )} IconRenderer={Icon} icons={{ check: { name: 'check-circle', style: { color: Colors.secondary }, size: 22 }, search: { name: 'search', color: '#333', size: 22 } }} />