import { FlatList, ScrollView, StyleSheet, Text, TextInput, View, } from "react-native"; import React, { useEffect, useState } from "react"; import { Dimensions } from "react-native"; import { RootState, useAppDispatch } from "../../redux/store"; import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import { useSelector } from "react-redux"; import Slider from "@react-native-community/slider"; import { setCameraSettings } from "../../redux/UtilSlice"; import Button from "../atoms/Button"; import { setRicohAuthData, setRicohCaptureState, } from "../../redux/AppStateSlice"; type ToggleButtonProps = { inactiveIcon: string; activeIcon: string; key: string; }; type SliderProps = { min: number; max: number; value: number; key: string; }; const SettingsModal = () => { const dispatch = useAppDispatch(); const cameraSettings = useSelector( (appState: RootState) => appState.Util.cameraSettings ); const activeSlotIndex = useSelector( (state: RootState) => state.AOP.activeSlotIndex ); const activeStepIndex = useSelector( (state: RootState) => state.AOP.activeStepIndex ); const { ricohAuth } = useSelector( (state: RootState) => state.AppState ); const [ricohIP, setRicohIP] = useState(ricohAuth?.ip); const [ricohUsername, setRicohUsername] = useState(ricohAuth?.username); const [ricohPassword, setRicohPassword] = useState(ricohAuth?.password); const steps = useSelector((state: RootState) => state.AOP.steps); const slotList = steps.length > 0 ? steps[activeStepIndex].slots : []; const currentAction = slotList.length > 0 ? slotList[activeSlotIndex].action : undefined; useEffect(() => { setRicohPassword(ricohAuth?.password); setRicohIP(ricohAuth?.ip); setRicohUsername(ricohAuth?.username); }, [ricohAuth]); const { orientation } = useSelector((appState: RootState) => appState.Util); return ( {(currentAction?.sourceType === "DeviceCamera" && ( <> dispatch( setCameraSettings({ ...cameraSettings, fps, }) ) } step={1} minimumTrackTintColor="white" maximumTrackTintColor="grey" /> {cameraSettings.fps} FPS {currentAction && !currentAction.vision && ( <> dispatch( setCameraSettings({ ...cameraSettings, whiteBalance: { ...cameraSettings.whiteBalance, tint, }, }) ) } step={1} minimumTrackTintColor="white" maximumTrackTintColor="grey" /> {cameraSettings.whiteBalance.tint} Tint dispatch( setCameraSettings({ ...cameraSettings, whiteBalance: { ...cameraSettings.whiteBalance, temperature, }, }) ) } step={100} minimumTrackTintColor="white" maximumTrackTintColor="grey" /> {cameraSettings.whiteBalance.temperature}k Temperature )}