add function to check platform and return alert
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user