Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosBuilding AMD Helios: Testing and Validating Rackscale AI Solutions(24.09.2026 um 17:30 Uhr)
Podcasts & Audio Briefings9to5Google: The Googlebook could do something insane.(24.09.2026 um 17:30 Uhr)
YouTube Security VideosBack to School Raspberry Pi Quiz! #bermonths #quiz #raspberrypi(24.09.2026 um 17:24 Uhr)
YouTube Security VideosPC-WELT: Endlich hat die 2. RTX 5090 Sinn - lokale KI auf HMX 6!(24.09.2026 um 17:30 Uhr)
Windows Tipps & SecurityuBlock Origin broke on Edge, so I finally quit the browser(24.09.2026 um 17:24 Uhr)
Windows Tipps & SecurityHMX 6: Wir müssen reden(24.09.2026 um 17:30 Uhr)
Windows Tipps & SecurityWinamp Community Update Project(24.09.2026 um 16:40 Uhr)
YouTube Security VideosBuilding AMD Helios: Testing and Validating Rackscale AI Solutions(24.09.2026 um 17:30 Uhr)
Podcasts & Audio Briefings9to5Google: The Googlebook could do something insane.(24.09.2026 um 17:30 Uhr)
YouTube Security VideosBack to School Raspberry Pi Quiz! #bermonths #quiz #raspberrypi(24.09.2026 um 17:24 Uhr)
YouTube Security VideosPC-WELT: Endlich hat die 2. RTX 5090 Sinn - lokale KI auf HMX 6!(24.09.2026 um 17:30 Uhr)
Windows Tipps & SecurityuBlock Origin broke on Edge, so I finally quit the browser(24.09.2026 um 17:24 Uhr)
Windows Tipps & SecurityHMX 6: Wir müssen reden(24.09.2026 um 17:30 Uhr)
Windows Tipps & SecurityWinamp Community Update Project(24.09.2026 um 16:40 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to Create a Dropdown from Scratch in React Native

Dropdown menus are essential UI components that allow users to select one option from a list. In React Native, dropdowns can be implemented in various ways, depending on the design and user experience requirements. Here, we’ll explore two a…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Dropdown menus are essential UI components that allow users to select one option from a list. In React Native, dropdowns can be implemented in various ways, depending on the design and user experience requirements. Here, we’ll explore two approaches to creating dropdowns from scratch:




  • Using a Modal to display the dropdown.

  • Inline display of the dropdown below a button or text field.









Prerequisites



Before starting, ensure you have React Native set up in your project. You can install React Native using:




npx react-native init MyApp












Approach 1: Dropdown Using a Modal



The modal approach is useful in cases where you want the dropdown to take up the full screen or focus the user’s attention on the options.






Steps:




  • Create a Dropdown component that toggles a modal.

  • Render dropdown options inside the modal.

  • Pass the selected value back to the parent.






Code:






import React, { useState } from "react";
import {
View,
Text,
Modal,
TouchableOpacity,
FlatList,
StyleSheet,
} from "react-native";

const ModalDropdown = ({ data, onSelect }) => {
const [isModalVisible, setModalVisible] = useState(false);
const [selectedValue, setSelectedValue] = useState(null);

const toggleModal = () => setModalVisible(!isModalVisible);

const handleSelect = (item) => {
setSelectedValue(item);
onSelect(item);
toggleModal();
};

return (
<View style={styles.container}>
<TouchableOpacity style={styles.button} onPress={toggleModal}>
<Text style={styles.buttonText}>
{selectedValue || "Select an option"}
</Text>
</TouchableOpacity>

<Modal visible={isModalVisible} transparent animationType="slide">
<View style={styles.modalBackground}>
<View style={styles.modalContent}>
<FlatList
data={data}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => (
<TouchableOpacity
style={styles.option}
onPress={() => handleSelect(item)}
>
<Text style={styles.optionText}>{item}</Text>
</TouchableOpacity>
)}
/>
<TouchableOpacity style={styles.closeButton} onPress={toggleModal}>
<Text style={styles.closeText}>Close</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
</View>
);
};

const styles = StyleSheet.create({
container: {
margin: 20,
},
button: {
padding: 15,
backgroundColor: "#3498db",
borderRadius: 5,
},
buttonText: {
color: "white",
textAlign: "center",
},
modalBackground: {
flex: 1,
backgroundColor: "rgba(0, 0, 0, 0.5)",
justifyContent: "center",
alignItems: "center",
},
modalContent: {
width: "80%",
backgroundColor: "white",
borderRadius: 10,
padding: 20,
},
option: {
padding: 15,
borderBottomWidth: 1,
borderBottomColor: "#ddd",
},
optionText: {
fontSize: 16,
},
closeButton: {
marginTop: 10,
padding: 10,
backgroundColor: "#e74c3c",
borderRadius: 5,
},
closeText: {
color: "white",
textAlign: "center",
},
});

export default ModalDropdown;









Screenshots:



modal dropdown



modal dropdown value









Approach 2: Dropdown Displayed Inline



This design showcases the dropdown directly beneath a button or text field; it is incorporated into the screen layout very smoothly.






Steps:




  • Use a TouchableOpacity to toggle the visibility of the dropdown.

  • Dynamically position the dropdown list below the button.

  • Use FlatList to render the options.






Code:






import React, { useState } from "react";
import {
View,
Text,
TouchableOpacity,
FlatList,
StyleSheet,
} from "react-native";

const InlineDropdown = ({ data, onSelect }) => {
const [isDropdownVisible, setDropdownVisible] = useState(false);
const [selectedValue, setSelectedValue] = useState(null);
const toggleDropdown = () => setDropdownVisible(!isDropdownVisible);
const handleSelect = (item) => {
setSelectedValue(item);
onSelect(item);
setDropdownVisible(false);
};
return (
<View style={styles.container}>
<TouchableOpacity style={styles.button} onPress={toggleDropdown}>
<Text style={styles.buttonText}>
{selectedValue || "Select an option"}{" "}
</Text>
</TouchableOpacity>
{isDropdownVisible && (
<View style={styles.dropdown}>
<FlatList
data={data}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => (
<TouchableOpacity
style={styles.option}
onPress={() => handleSelect(item)}
>
<Text style={styles.optionText}>{item}</Text>{" "}
</TouchableOpacity>
)}
/>
</View>
)}
</View>
);
};
const styles = StyleSheet.create({
container: {
margin: 20,
},
button: {
padding: 15,
backgroundColor: "#3498db",
borderRadius: 5,
},
buttonText: {
color: "white",
textAlign: "center",
},
dropdown: {
marginTop: 5,
backgroundColor: "white",
borderRadius: 5,
elevation: 3,
shadowColor: "#000",
shadowOpacity: 0.1,
shadowRadius: 5,
shadowOffset: { width: 0, height: 2 },
},
option: {
padding: 15,
borderBottomWidth: 1,
borderBottomColor: "#ddd",
},
optionText: {
fontSize: 16,
},
});

export default InlineDropdown;









Screenshot:



inline dropdown









Comparison



dropdown comparison









Conclusion



Different use cases are suited for modal and inline dropdowns in React Native. While the modal approach is effective for scenarios requiring a focused user interaction, the inline dropdown is ideal for scenarios where a seamless, lightweight experience is desirable.



You can thus implement either of these approaches using the code above or customize them to suit your application needs.






Thank you for reading! Feel free to connect with me on LinkedIn or GitHub.

SOC Incident Playbook: Vulnerability Remediation & Verification
title: Detect Exploitation - How to Create a Dropdown from Scratch in React Native
id: 3b499a2f-77e8-4004-afa4-8e1253282187
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "How to Create a Dropdown from " ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How to Create a Dropdown from Scratch in.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Create a Dropdown from Scratch in React Native

Thematisch verwandte Begriffe: Create, Dropdown, from, Scratch · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-79764 | Termix is a web-based server management platform with SSH terminal, tunn…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle