I want to make dropdown view using scrollview in react native, but scrollview is not scrolling in android while its position is absolute, in IOS it is scrolling like a charm.
This is my code
<View style={{ flexDirection: 'row', zIndex: 1 }}>
<TouchableOpacity
style={styles.contryCode}
onPress={()=>setVisible(prev=>!prev)}
>
<Text style={styles.selectedCode}>{code}</Text>
<Icon name={visible ? 'up' : 'down'} size={15} color='#000' />
</TouchableOpacity>
{visible ? <CodeList /> : null}
</View>
const CodeList = () => {
return (
<ScrollView
style={styles.codeList}
showsVerticalScrollIndicator={false}
>
{codes.map((item: any, index: number) => {
return (
<TouchableOpacity key={index} onPress={() => handleSelectCountry(item?.phonecode)}>
<Text style={styles.codeText}>{item.phonecode}</Text>
</TouchableOpacity>
);
})}
</ScrollView>
)
}
I also tried wrapping Scrollview
with posotion:'relative'
in a View
with position:'absolute'
, but it did not worked.