Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
Cannot post data to the API using Picker with Formik

I'm trying to post data to the API using Picker and Formik, but in Formik it returns an empty value from Picker.

The problem is detected in the Picker, in onValueChange.

NOTE: In the Picker, get data successfully.

<Formik
   initialValues={{ article: '', type: '' }}
    onSubmit={(values, { setSubmitting }) => {
        if(values.article == '') {
            handleMessage('The field is mandatory');
            setSubmitting(false);
        } else {
            console.log(values);
            handleCreateItem(values, setSubmitting);
        }
    }}
>
    {({handleChange, handleBlur, handleSubmit, values, isSubmitting}) => (
        <CFormArea>
            <TextInput
                placeholder="Article"
                placeholderTextColor={text}
                onChangeText={handleChange('article')}
                onBlur={handleBlur('article')}
                value={values.article}
            />
            <CLabel>Type</CLabel>
            <Picker
                style={{color:'white'}}
                selectedValue={values.type} 
                onValueChange={(itemValue) => handleChange('type', itemValue)}
            >
            {
                getType.map((types, index) => {
                    return <Picker.Item key={index} label={types.material} value={types.id}  /> 
                })
            }
            </Picker>
            {!isSubmitting && (
                <Button onPress={handleSubmit}>
                    <TextButton> Create Item </TextButton>
                </Button>
            )}
        </CFormArea>
    )}
</Formik>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda