I am having issues with the "TouchableOpacity" "onPress". When I click on it, nothing happens. I made it as a component so I can call it from app.js.
Am I doing something wrong? Please help!
Here is my code:
const DropDownBox = () => {
const [SelectedValue, SetSelectedValue] = useState(-1);
function ComboBox() {
return (
<View style={styles.container}>
<ModalDropdown
options={LeavesData}
defaultValue="Please Select Leave"
style={styles.dropdownContainer}
textStyle={styles.DropdownText}
dropdownStyle={styles.dropdownbox}
onSelect={SetSelectedValue}
>
</ModalDropdown>
</View>
)
}
//Index to Value
var Value = "";
Value = LeavesData[SelectedValue];
return (
<View>
<TouchableOpacity onPress= {() => ComboBox()} >
<Text style={styles.dropdownContainer}>Please Select</Text>
</TouchableOpacity>
<Text style={styles.displayText} >{Value} selected </Text>
</View>
)
}
export default DropDownBox;