images from camera WIP
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
ScrollView,
|
||||
} from "react-native";
|
||||
import { TextInput, Button, Snackbar } from "react-native-paper";
|
||||
import { requestCameraPermissionsAsync, launchCameraAsync } from 'expo-image-picker';
|
||||
import useLocationStore from "@/locationStore";
|
||||
|
||||
export default function FormScreen() {
|
||||
@@ -59,6 +60,20 @@ export default function FormScreen() {
|
||||
}
|
||||
};
|
||||
|
||||
const takePicture = async () => {
|
||||
const {status} = await requestCameraPermissionsAsync();
|
||||
if (status !== 'granted') {
|
||||
return;
|
||||
}
|
||||
const result = await launchCameraAsync({
|
||||
allowsEditing: false,
|
||||
});
|
||||
|
||||
if (!result.canceled && result.assets) {
|
||||
setImage(result.assets.map(asset => asset.uri));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<KeyboardAvoidingView
|
||||
style={{ flex: 1 }}
|
||||
@@ -124,6 +139,9 @@ export default function FormScreen() {
|
||||
>
|
||||
Dodaj
|
||||
</Button>
|
||||
<Button onPress={takePicture} style={{ margin: 10, width: "100%" }} icon="plus-circle-outline" mode={"contained"}>
|
||||
Zrób zdjęcie
|
||||
</Button>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user