import { FlatList, Platform, 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 { CameraSetting, setCaptureSetting } from "../../redux/UtilSlice"; import Button from "../atoms/Button"; import { setRicohAuthData, setRicohCaptureState, setRicohSetting } from "../../redux/AppStateSlice"; import FormField from "./FormField"; type Props = { open: boolean; }; const SettingsModalV2 = (props: Props) => { const dispatch = useAppDispatch(); const captureSettings = useSelector((appState: RootState) => appState.Util.captureSettings); 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 activeSlotItemIndex = useSelector((state: RootState) => state.AOP.activeSlotItemIndex); const activeSlotItemActionIndex = useSelector( (state: RootState) => state.AOP.activeSlotItemActionIndex ); const getCurrentAction = () => { if (slotList.length > 0) { const slot = slotList[activeSlotIndex]; if (slot.slotItems && slot.slotItems.length > 0) { if (activeSlotItemActionIndex >= 0) return slot.slotItems[activeSlotItemIndex].availableActions[activeSlotItemActionIndex]; else return undefined; } else { return slotList[activeSlotIndex].action; } } else return undefined; }; const currentAction = getCurrentAction(); useEffect(() => { setRicohPassword(ricohAuth?.password); setRicohIP(ricohAuth?.ip); setRicohUsername(ricohAuth?.username); }, [ricohAuth]); const ListItemComponent = (props: CameraSetting) => { switch (props.type) { case "slider": return ( { dispatch( setCaptureSetting({ settingsKey: props.settingsKey, value, }) ); }} step={props.step} minimumTrackTintColor="white" maximumTrackTintColor="grey" style={styles.slider} /> {props.value} {props.settingsKey} ); case "toggle": return (