Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Open modal drop down using onPress for react-native-modal-dropdown

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;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!