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

112
Views
Error implementing multiple dropdown with show or hide item

I have code with purpose to show menu with dropdown. The menu currently consists of 3 dropdowns. but when I click on one menu, the other menu items also appear. What is wrong? Below is the code:

  const [openJasa, setOpenJasa] = useState(false);
  const [openPenjualan, setOpenPenjualan] = useState(false);
  const [openKataPembeli, setOpenKataPembeli] = useState(false);

  const DATA = [
    {
      title: "Jasa",
      data: ["Pizza", "Burger", "Risotto"],
      onpress: () => setOpenJasa(!openJasa),
    },
    {
      title: "Penjualan",
      data: ["French Fries", "Onion Rings", "Fried Shrimps"],
      onpress: () => setOpenPenjualan(!openPenjualan),
    },
    {
      title: "Kata Pembeli",
      data: ["Water", "Coke", "Beer"],
      onpress: () => setOpenKataPembeli(!openKataPembeli),
    },
  ];

  return (
    <SafeAreaView style={styles.container}>
      <SectionList
        sections={DATA}
        keyExtractor={(item, index) => item + index}
        renderItem={({ item }) =>
          openPenjualan && (
            <View style={styles.item}>
              <Button title={item} onPress={() => navigation.navigate(item)} />
            </View>
          )
        }
        renderSectionHeader={({ section: { title, onpress } }) => (
          <Button title={title} onPress={onpress} />
        )}
      />
    </SafeAreaView>
  );
};
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!