KeyboardAvoidingView
ekran dodawania
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { Image, StyleSheet } from "react-native";
|
||||
import { Button, ButtonText } from "@/components/ui/button";
|
||||
import { FormControl } from "@/components/ui/form-control";
|
||||
import { Input, InputField } from "@/components/ui/input";
|
||||
import { Text } from "@/components/ui/text";
|
||||
import { VStack } from "@/components/ui/vstack";
|
||||
import { Textarea, TextareaInput } from "@/components/ui/textarea";
|
||||
import { ScrollView } from "@gluestack-ui/themed";
|
||||
import {useState, useEffect} from "react";
|
||||
import {Image, StyleSheet, KeyboardAvoidingView, Platform} from "react-native";
|
||||
import {Button, ButtonText} from "@/components/ui/button";
|
||||
import {FormControl} from "@/components/ui/form-control";
|
||||
import {Input, InputField} from "@/components/ui/input";
|
||||
import {Text} from "@/components/ui/text";
|
||||
import {VStack} from "@/components/ui/vstack";
|
||||
import {Textarea, TextareaInput} from "@/components/ui/textarea";
|
||||
import {ScrollView} from "@gluestack-ui/themed";
|
||||
import * as ImagePicker from "expo-image-picker";
|
||||
import {
|
||||
Select,
|
||||
@@ -20,14 +20,14 @@ import {
|
||||
SelectScrollView,
|
||||
} from "@/components/ui/select";
|
||||
|
||||
import { ChevronDownIcon } from "@/components/ui/icon";
|
||||
import { useNoticesStore } from "@/store/noticesStore";
|
||||
import { listCategories } from "@/api/categories";
|
||||
import { useRouter } from "expo-router";
|
||||
import {ChevronDownIcon} from "@/components/ui/icon";
|
||||
import {useNoticesStore} from "@/store/noticesStore";
|
||||
import {listCategories} from "@/api/categories";
|
||||
import {useRouter} from "expo-router";
|
||||
|
||||
export default function CreateNotice() {
|
||||
const router = useRouter();
|
||||
const { addNotice, fetchNotices } = useNoticesStore();
|
||||
const {addNotice, fetchNotices} = useNoticesStore();
|
||||
const [title, setTitle] = useState("");
|
||||
const [description, setDescription] = useState("");
|
||||
const [price, setPrice] = useState("");
|
||||
@@ -116,7 +116,7 @@ export default function CreateNotice() {
|
||||
};
|
||||
|
||||
const takePicture = async () => {
|
||||
const { status } = await ImagePicker.requestCameraPermissionsAsync();
|
||||
const {status} = await ImagePicker.requestCameraPermissionsAsync();
|
||||
if (status !== "granted") {
|
||||
return;
|
||||
}
|
||||
@@ -159,6 +159,11 @@ export default function CreateNotice() {
|
||||
};
|
||||
|
||||
return (
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
||||
style={{flex: 1}}
|
||||
keyboardVerticalOffset={Platform.OS === 'ios' ? 64 : 0}
|
||||
>
|
||||
<ScrollView h="$80" w="$80">
|
||||
<FormControl className="p-4 border rounded-lg border-outline-300">
|
||||
<VStack space="xl">
|
||||
@@ -178,7 +183,7 @@ export default function CreateNotice() {
|
||||
{image.map((img, index) => (
|
||||
<Image
|
||||
key={index}
|
||||
source={{ uri: img }}
|
||||
source={{uri: img}}
|
||||
style={styles.image}
|
||||
className="m-1"
|
||||
/>
|
||||
@@ -230,12 +235,12 @@ export default function CreateNotice() {
|
||||
isInvalid={error.category}
|
||||
>
|
||||
<SelectTrigger variant="outline" size="md">
|
||||
<SelectInput placeholder="Wybierz kategorię" />
|
||||
<SelectIcon className="mr-3" as={ChevronDownIcon} />
|
||||
<SelectInput placeholder="Wybierz kategorię"/>
|
||||
<SelectIcon className="mr-3" as={ChevronDownIcon}/>
|
||||
</SelectTrigger>
|
||||
<SelectPortal>
|
||||
<SelectBackdrop />
|
||||
<SelectContent style={{ maxHeight: 400 }}>
|
||||
<SelectBackdrop/>
|
||||
<SelectContent style={{maxHeight: 400}}>
|
||||
<SelectScrollView>
|
||||
{selectItems.map((item) => (
|
||||
<SelectItem
|
||||
@@ -259,5 +264,6 @@ export default function CreateNotice() {
|
||||
</VStack>
|
||||
</FormControl>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user