import React from "react"; import { useFormikContext } from "formik"; import ErrorMessage from "./ErrorMessage"; import ImageInputList from "../ImageInputList"; import { View, Text, StyleSheet } from "react-native"; import colors from "../../config/colors"; import { dimensions } from "../../config/dimensions"; function FormImagePicker({ name }) { const { errors, setFieldValue, touched, values } = useFormikContext(); const imageUris = values[name]; const handleAdd = (uri) => { setFieldValue(name, [...imageUris, uri]); }; const handleRemove = (uri) => { setFieldValue( name, imageUris.filter((imageUri) => imageUri !== uri) ); }; return ( ); } const styles = StyleSheet.create({ labelStyle: { fontSize: dimensions.text.secondary, fontWeight: "bold", textAlign: "left", color: colors.primary, marginBottom: 5, marginTop: 15, }, }); export default FormImagePicker;