kevin/add-form #14

Merged
fr merged 6 commits from kevin/add-form into main 2024-05-12 21:44:09 +02:00
3 changed files with 32 additions and 25 deletions
Showing only changes of commit 114ab257b2 - Show all commits

View File

@ -3,7 +3,7 @@ import { useState } from "react";
import Button from "@components/Button"; import Button from "@components/Button";
import { colors } from "@components/style"; import { colors } from "@components/style";
import * as ImagePicker from "expo-image-picker"; import * as ImagePicker from "expo-image-picker";
import { Picker } from "@react-native-picker/picker"; import DropDownPicker from "react-native-dropdown-picker";
export default function BeerAdd() { export default function BeerAdd() {
const [b_name, setBName] = useState(""); const [b_name, setBName] = useState("");
@ -13,6 +13,16 @@ export default function BeerAdd() {
const [image, setImage] = useState(null); const [image, setImage] = useState(null);
const [selectPackaging, setSelectedPackaging] = useState(); const [selectPackaging, setSelectedPackaging] = useState();
const [open, setOpen] = useState(false);
const [value, setValue] = useState(null);
const [items, setItems] = useState([
{ label: "Can", value: "can" },
{ label: "Glass bottle", value: "glass" },
{ label: "Oddel barrel", value: "barrel" },
{ label: "Tank", value: "tank" },
{ label: "PET bottle", value: "PET" },
]);
ImagePicker.getCameraPermissionsAsync(); //check if the user has granted permission to access the camera ImagePicker.getCameraPermissionsAsync(); //check if the user has granted permission to access the camera
const pickImage = async () => { const pickImage = async () => {
const permissionResult = const permissionResult =
@ -114,19 +124,16 @@ export default function BeerAdd() {
onChangeText={(text) => setBPackaging(text)} onChangeText={(text) => setBPackaging(text)}
placeholderTextColor="#aaaaaa" placeholderTextColor="#aaaaaa"
/> />
<Picker <DropDownPicker
selectedValue={selectPackaging} open={open}
onValueChange={(itemValue, itemIndex) => value={value}
setSelectedPackaging(itemValue) items={items}
} setOpen={setOpen}
> setValue={setValue}
<Picker.Item label="Can" value="can" /> setItems={setItems}
<Picker.Item label="Glass" value="glass" /> placeholder={"What are you drinking from?"}
<Picker.Item label="Pint" value="pint" /> theme="DARK"
<Picker.Item label="Oddel Barrel" value="oddelBarel" /> />
<Picker.Item label="Tank" value="tank" />
<Picker.Item label="PET bottle" value="petBottle" />
</Picker>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
<Button <Button
style={styles.imageButton} style={styles.imageButton}

View File

@ -10,7 +10,6 @@
"dependencies": { "dependencies": {
"@expo/metro-runtime": "~3.2.1", "@expo/metro-runtime": "~3.2.1",
"@react-native-async-storage/async-storage": "^1.23.1", "@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-picker/picker": "2.7.5",
"@types/react": "~18.2.45", "@types/react": "~18.2.45",
"axios": "^1.6.8", "axios": "^1.6.8",
"expo": "^51.0.2", "expo": "^51.0.2",
@ -25,6 +24,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-native": "0.74.1", "react-native": "0.74.1",
"react-native-dropdown-picker": "^5.4.6",
"react-native-safe-area-context": "4.10.1", "react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1", "react-native-screens": "3.31.1",
"react-native-web": "~0.19.6" "react-native-web": "~0.19.6"
@ -5581,15 +5581,6 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@react-native-picker/picker": {
"version": "2.7.5",
"resolved": "https://registry.npmjs.org/@react-native-picker/picker/-/picker-2.7.5.tgz",
"integrity": "sha512-vhMaOLkXSUb+YKVbukMJToU4g+89VMhBG2U9+cLYF8X8HtFRidrHjohGqT8/OyesDuKIXeLIP+UFYI9Q9CRA9Q==",
"peerDependencies": {
"react": "*",
"react-native": "*"
}
},
"node_modules/@react-native/assets-registry": { "node_modules/@react-native/assets-registry": {
"version": "0.74.83", "version": "0.74.83",
"resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.83.tgz", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.83.tgz",
@ -12886,6 +12877,15 @@
} }
} }
}, },
"node_modules/react-native-dropdown-picker": {
"version": "5.4.6",
"resolved": "https://registry.npmjs.org/react-native-dropdown-picker/-/react-native-dropdown-picker-5.4.6.tgz",
"integrity": "sha512-T1XBHbE++M6aRU3wFYw3MvcOuabhWZ29RK/Ivdls2r1ZkZ62iEBZknLUPeVLMX3x6iUxj4Zgr3X2DGlEGXeHsA==",
"peerDependencies": {
"react": "*",
"react-native": "*"
}
},
"node_modules/react-native-helmet-async": { "node_modules/react-native-helmet-async": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/react-native-helmet-async/-/react-native-helmet-async-2.0.4.tgz", "resolved": "https://registry.npmjs.org/react-native-helmet-async/-/react-native-helmet-async-2.0.4.tgz",

View File

@ -11,7 +11,6 @@
"dependencies": { "dependencies": {
"@expo/metro-runtime": "~3.2.1", "@expo/metro-runtime": "~3.2.1",
"@react-native-async-storage/async-storage": "^1.23.1", "@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-picker/picker": "2.7.5",
"@types/react": "~18.2.45", "@types/react": "~18.2.45",
"axios": "^1.6.8", "axios": "^1.6.8",
"expo": "^51.0.2", "expo": "^51.0.2",
@ -26,6 +25,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-native": "0.74.1", "react-native": "0.74.1",
"react-native-dropdown-picker": "^5.4.6",
"react-native-safe-area-context": "4.10.1", "react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1", "react-native-screens": "3.31.1",
"react-native-web": "~0.19.6" "react-native-web": "~0.19.6"