images from camera WIP
This commit is contained in:
8
app.json
8
app.json
@@ -27,7 +27,13 @@
|
|||||||
"bundler": "metro"
|
"bundler": "metro"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"expo-router"
|
"expo-router",
|
||||||
|
[
|
||||||
|
"expo-image-picker",
|
||||||
|
{
|
||||||
|
"photosPermission": "The app accesses your photos to let you share them with your friends."
|
||||||
|
}
|
||||||
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
ScrollView,
|
ScrollView,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { TextInput, Button, Snackbar } from "react-native-paper";
|
import { TextInput, Button, Snackbar } from "react-native-paper";
|
||||||
|
import { requestCameraPermissionsAsync, launchCameraAsync } from 'expo-image-picker';
|
||||||
import useLocationStore from "@/locationStore";
|
import useLocationStore from "@/locationStore";
|
||||||
|
|
||||||
export default function FormScreen() {
|
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 (
|
return (
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
@@ -124,6 +139,9 @@ export default function FormScreen() {
|
|||||||
>
|
>
|
||||||
Dodaj
|
Dodaj
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button onPress={takePicture} style={{ margin: 10, width: "100%" }} icon="plus-circle-outline" mode={"contained"}>
|
||||||
|
Zrób zdjęcie
|
||||||
|
</Button>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
"expo-linking": "~7.1.4",
|
"expo-linking": "~7.1.4",
|
||||||
"expo-router": "~5.0.7",
|
"expo-router": "~5.0.7",
|
||||||
"expo-status-bar": "~2.2.3",
|
"expo-status-bar": "~2.2.3",
|
||||||
|
"expo-image-picker": "~16.1.4",
|
||||||
"react": "19.0.0",
|
"react": "19.0.0",
|
||||||
"react-dom": "19.0.0",
|
"react-dom": "19.0.0",
|
||||||
"react-native": "0.79.2",
|
"react-native": "0.79.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user