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

171
Visualizações
How can i fix my laggy textinput in react-native

I am using the EXPO App to test my react-native project. When I type things in the TextInput the app begins to lag. Anyone know why and how to fix it?

            <View style={styles.logincontainercontainer}>
                <View style={styles.logincontainer}>
                    <Icon name="email" size={25} color={COLORS.grey} />
                    <TextInput  
                        style={{paddingLeft:3, flex:1}}
                        placeholderTextColor={COLORS.grey} placeholder="Email"
                        value={email}
                        blurOnSubmit={false}
                        onSubmitEditing={() => secondTextInput.focus() }
                        onChangeText={text=> setemail(text)}
                    />
                </View>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I don't know if you have a useEffect() that have a dependency on your text. But if this keeps persisting, I recommend you to use debounce function to wrap the setemail function.

function debounce(func, timeout = 300){
  let timer;
  return (...args) => {
    clearTimeout(timer);
    timer = setTimeout(() => { func.apply(this, args); }, timeout);
  };
}

const processEmailChange = debounce((t) => setemail(t));

  

And use processEmailChange inside onChangeText like onChangeText={(text)=>processEmailChange(text)}

about 4 years ago · Juan Pablo Isaza Relatório

0

Check and see if it re-renders a lot for each key stroke by adding a console log in your use effect. Then,Try removing all the console logs in the component and this email dependency from the dependency array of useEffect

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