I'm working on a custom dropdown component in React Native and I've encountered an issue regarding the position of the ScrollView's scrollbar.
Here is the part of the code where the issue arises:
<Modal visible={modalVisible} onRequestClose={toggleModal} transparent>
<TouchableOpacity style={styles.overlay} onPress={toggleModal} activeOpacity={1}/>
<View
style={[styles.modal, modalStyle, {
top: dropdownPosition ? dropdownPosition.y + dropdownPosition.height + 5 : 0,
left: dropdownPosition ? dropdownPosition.x : 0,
width: dropdownPosition ? dropdownPosition.width : null,
},]}
>
<ScrollView>
{data.map((option, index) => (
<TouchableOpacity
key={index}
style={[styles.option, optionStyle]}
onPress={() => handleSelect(option)}
>
<MText
style={optionTextStyle ? optionTextStyle : styles.optionText}>{typeof option === 'string' ? option : option.label}</MText>
</TouchableOpacity>
))}
</ScrollView>
</View>
</Modal>
And the styles are:
const styles = StyleSheet.create({
container: {
backgroundColor: '#ececec', padding: 3, borderRadius: 15
},
overlay: {
width: '100%', height: '100%', position: "absolute"
},
modal: {
borderRadius: 15, height: '20%', backgroundColor: '#ececec'
},
option: {
borderBottomColor: 'white', borderBottomWidth: 1
},
optionText: {
padding: 10, fontSize: 15
},
labelDropdown: {
padding: 3, fontSize: 15
}
});
The issue is that my modal has rounded corners (borderRadius: 15), and the scrollbar is appearing outside the rounded corner (see attached image). I'd like the scrollbar to be positioned slightly more to the left, so that it fits within the rounded corner of the modal.
I understand that the scrollbar's position is not directly configurable in React Native, but is there any workaround or hack that I can use to achieve this effect?
exceedBorderBottom exceedBorderTop
Any help would be greatly appreciated.