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

152
Vistas
React native text input synthetic event issue

I have made a reusable textinput component in react native, but when I am trying to access text value it gives me synthetic event object then the text value, I am not able to target text value. I know this maybe a possible duplicate but I have tried many methods but it isn't working. Here is my code snippet.

/**Imported Component **/

<InputField
     placeholder="Disabilities"
     defaultValue={values.associatedDisabilities.toString()}
     onChange={(value) => console.log(value)}
/>

/**Reusable Component **/

<TextInput
          style={[
            styles.textInput,
            props.style,
            { color: theme.colors.mainForeground },
          ]}
          onChangeText={props.onChange}
          defaultValue = {props.defaultValue}
          value={props.value}
          onBlur={props.onBlur}
          {...props}
          placeholderTextColor={
            currentTheme === ThemeTypes.LIGHT
              ? theme.colors.secondaryText
              : theme.colors.mainForeground
          }
          editable={props.editable}
          selectTextOnFocus={props.editable}
/>

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You need to pass it on the onChange in order to have the value you are looking for:

<TextInput
          style={[
            styles.textInput,
            props.style,
            { color: theme.colors.mainForeground },
          ]}
          onChangeText={(value) => props.onChange(value)}
          defaultValue = {props.defaultValue}
          value={props.value}
          onBlur={props.onBlur}
          {...props}
          placeholderTextColor={
            currentTheme === ThemeTypes.LIGHT
              ? theme.colors.secondaryText
              : theme.colors.mainForeground
          }
          editable={props.editable}
          selectTextOnFocus={props.editable}
/>

In second place, you need to control imported comp:

<InputField
     placeholder="Disabilities"
     defaultValue={values.associatedDisabilities.toString()}
     onChange={(value) => console.log(value)}
     value
/>

Otherwise you can use event.target.value, that is the native event value of the input component

about 4 years ago · Santiago Gelvez Denunciar
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