Adjusted camera stack and app reducer.

This commit is contained in:
Patrick Fic
2020-11-09 20:39:45 -08:00
parent ab1e04f564
commit e2e6f0b510
11 changed files with 437 additions and 310 deletions

View File

@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from "react";
import { Text, View, TouchableOpacity } from "react-native";
import { Text, View, TouchableOpacity, SafeAreaView } from "react-native";
import { Camera } from "expo-camera";
import {
Ionicons,
@@ -11,7 +11,20 @@ import * as FileSystem from "expo-file-system";
import * as Permissions from "expo-permissions";
import * as MediaLibrary from "expo-media-library";
export default function ScreenCamera() {
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import {
selectCurrentCameraJobId,
selectCurrentCameraJob,
} from "../../redux/app/app.selectors";
const mapStateToProps = createStructuredSelector({
cameraJobId: selectCurrentCameraJobId,
cameraJob: selectCurrentCameraJob,
});
const mapDispatchToProps = (dispatch) => ({});
export function ScreenCamera({ cameraJobId, cameraJob }) {
const navigation = useNavigation();
const [hasPermission, setHasPermission] = useState(null);
const [rollPermision, setRollPermission] = useState(null);
@@ -86,57 +99,94 @@ export default function ScreenCamera() {
return (
<View style={{ display: "flex", flex: 1 }}>
<Camera style={{ flex: 1 }} type={type} ref={cameraRef}>
<View
<SafeAreaView
style={{
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
margin: 20,
// marginTop: 40,
}}
>
<TouchableOpacity
onPress={handleCameraType}
onPress={() => navigation.push("CameraJobSearch")}
style={{
alignSelf: "flex-end",
display: "flex",
width: "100%",
alignSelf: "flex-start",
alignItems: "center",
backgroundColor: "transparent",
backgroundColor: "rgba(112, 128, 144, 0.3)",
fontSize: 20,
fontWeight: "bold",
}}
>
<MaterialCommunityIcons
name="camera-switch"
style={{ color: "#fff", fontSize: 40 }}
/>
<Text
style={{
fontSize: 20,
fontWeight: "bold",
}}
>
{cameraJob && cameraJob.ro_number}
</Text>
<Text>
{cameraJob &&
`${cameraJob && cameraJob.ownr_fn} ${
cameraJob && cameraJob.ownr_ln
}`}
</Text>
<Text>{cameraJobId}</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={handleTakePicture}
<View
style={{
alignSelf: "flex-end",
alignItems: "center",
backgroundColor: "transparent",
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
margin: 20,
}}
>
<FontAwesome
name="camera"
style={{ color: "#fff", fontSize: 40 }}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
navigation.push("MediaCache");
}}
style={{
alignSelf: "flex-end",
alignItems: "center",
backgroundColor: "transparent",
}}
>
<Ionicons
name="ios-photos"
style={{ color: "#fff", fontSize: 40 }}
/>
</TouchableOpacity>
</View>
<TouchableOpacity
onPress={handleCameraType}
style={{
alignSelf: "flex-end",
alignItems: "center",
backgroundColor: "transparent",
}}
>
<MaterialCommunityIcons
name="camera-switch"
style={{ color: "#fff", fontSize: 40 }}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={handleTakePicture}
style={{
alignSelf: "flex-end",
alignItems: "center",
backgroundColor: "transparent",
}}
>
<FontAwesome
name="camera"
style={{ color: "#fff", fontSize: 40 }}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
navigation.push("MediaCache");
}}
style={{
alignSelf: "flex-end",
alignItems: "center",
backgroundColor: "transparent",
}}
>
<Ionicons
name="ios-photos"
style={{ color: "#fff", fontSize: 40 }}
/>
</TouchableOpacity>
</View>
</SafeAreaView>
</Camera>
</View>
);
}
export default connect(mapStateToProps, mapDispatchToProps)(ScreenCamera);