Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
Why the input name is not changing its value?

I'm trying to edit the user profile data, and when I change the name in the input field, it won't change, it keeps the name that the user has.

 const [nameInput, setNameInput] = useState('');


  const editUserData = () => {
    const userParams = {
      phone: phone,
      fullName: nameInput,
      gender: value,
      birthdate: date,
    };
    axios
      .put('url', userParams)
      .then((response) => {
        console.log('response', response.data);
      })
      .catch((error) => {
        console.log(error.message);
      });
  };

  <TextInput
      style={styles.nameInputStyle}
      onChangeText={(event) => setNameInput(event)}
      value={nameInput}
      keyboardType="email-address"
      returnKeyType="done"
      onEndEditing={(e) => handleValidName(e.nativeEvent.text)}
      autoCapitalize="sentences"
   />

How can I change the value name in the input field?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to set it to event.target.value, not event:

<TextInput
      style={styles.nameInputStyle}
      onChangeText={(event) => setNameInput(event.target.value)}
      value={nameInput}
      keyboardType="email-address"
      returnKeyType="done"
      onEndEditing={(e) => handleValidName(e.nativeEvent.text)}
      autoCapitalize="sentences"
/>

EDIT

event.target.value won't work. Use this instead:

<TextInput
      style={styles.nameInputStyle}
      onChangeText={setNameInput}
      value={nameInput}
      keyboardType="email-address"
      returnKeyType="done"
      onEndEditing={(e) => handleValidName(e.nativeEvent.text)}
      autoCapitalize="sentences"
/>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda