add function to check platform and return alert

This commit is contained in:
Loewy
2024-02-12 12:51:04 -08:00
parent 92e211a21a
commit d3db06a90c
3 changed files with 27 additions and 20 deletions

View File

@@ -1,8 +1,6 @@
import React, { useCallback, useState } from "react";
import {
Alert,
Keyboard,
Platform,
Text,
TextInput,
TouchableOpacity,
@@ -12,7 +10,7 @@ import {
import DropDownPicker from "react-native-dropdown-picker";
// @ts-ignore
import { useCameraPermission } from "react-native-vision-camera";
import { cameraPermissionsDenied } from "../../lib/alert-messages";
import { showAlert } from "../../lib/alert-messages";
import { recordStyles as styles } from "./styles";
interface CameraScreenParams {
@@ -72,16 +70,9 @@ export default function RecordScreen({ navigation }): React.JSX.Element {
// Location
const [location, setLocation] = useState<string>("");
const { android, ios } = cameraPermissionsDenied;
const handleSubmit = () => {
// Next block's alert message are OS specific
if (!hasPermission) {
if (Platform.OS === "android") {
return Alert.alert(android.title, android.message);
} else {
return Alert.alert(ios.title, ios.message);
}
return showAlert("camera");
}
// needs to pass info as params or store in a context/state provider