tadd select component
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import ScanQRCode from "@/components/ScanQRCode";
|
||||
import Select from "@/components/Select";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Platform,
|
||||
@@ -21,13 +22,32 @@ export default function Sensor() {
|
||||
const handleScanPress = () => {
|
||||
setScanModalVisible(true);
|
||||
};
|
||||
const [selectedValue, setSelectedValue] = useState<
|
||||
string | number | undefined
|
||||
>(undefined);
|
||||
|
||||
const options = [
|
||||
{ label: "Apple", value: "apple" },
|
||||
{ label: "Banana", value: "banana" },
|
||||
{ label: "Cherry", value: "cherry", disabled: true },
|
||||
];
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
<ScrollView contentContainerStyle={styles.scrollContent}>
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.titleText}>Cảm biến trên tàu</Text>
|
||||
|
||||
<Select
|
||||
style={{ width: "80%", marginBottom: 20 }}
|
||||
options={options}
|
||||
value={selectedValue}
|
||||
onChange={(val) => {
|
||||
setSelectedValue(val);
|
||||
console.log("Value: ", val);
|
||||
}}
|
||||
placeholder="Select a fruit"
|
||||
allowClear
|
||||
/>
|
||||
<Pressable style={styles.scanButton} onPress={handleScanPress}>
|
||||
<Text style={styles.scanButtonText}>📱 Scan QR Code</Text>
|
||||
</Pressable>
|
||||
|
||||
Reference in New Issue
Block a user