Take the code below which works fine:
function Test() {
const txt = 'a'
const fruit = [
{ name: 'apple' },
{ name: 'orange' },
{ name: 'kiwi' },
{ name: 'banana' },
{ name: 'lemon' },
]
return (
<FlatList
data={fruit.filter((item) => String(item.name).includes(txt))}
renderItem={({ item }) => <Text>{item.name}</Text>}
/>
)
}
export default Test
The search string (txt) is a so the output would be:
apple
orange
banana
So far so good, now I want to be able to type for example ae and get all the items in the array that include both a and e in any order, not just ae together. here is the expected result for const txt = 'ae':
apple
orange