I have data in FlatList which is working fine.
The data is hidden by default but when I click on the arrow, I want it to appear below the field.
Problem is that, when I click on the icon, it appears without problem but items are not clickable on it.
But if I set that state data true by default, the clickable to list items works fine because it gets rendered on screen.
My requirements are as when this list appears with state change, the list should appear and be clickable without a problem. Currently, it does appear but when I try to click items, it disappears.
How we can do it? Because I also need to add a search on it later on. Please provide a long-term solution.
Code:
{getD ? (
<View style={{ flex: 1 }}>
<FlatList
style={{
flexGrow: 1,
flexShrink: 1,
flexDirection: 'column',
overflow: 'scroll',
maxHeight: 150,
position: 'absolute',
width: '100%',
zIndex: 10,
elevation: 10,
backgroundColor: '#ffffff',
borderRadius: 5,
borderWidth: 1,
borderStyle: 'solid',
borderColor: '#D7D7D7',
shadowOffset: { height: 3, width: 0 },
shadowRadius: 10,
shadowColor: '#00000010',
shadowOpacity: 1,
flex: 1,
}}
data={recSet}
renderItem={({ item }) => (
<TouchableOpacity onPress={() => alert('xxxxx')}>
<View style={{}} />
<Text style={{}}>{item.title}</Text>
</TouchableOpacity>
)}
keyExtractor={(item) => item.id}
contentContainerStyle={{ flexGrow: 1 }}
extraData={getD}
/>
</View>
) : null}