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

227
Visualizações
antd InputNumber: execute function onChangeComplete instead of onChange
<Form.Item
        label="Amount"
        name={[index, 'amount']}
      >
        <InputNumber
          style={{ width: '100%' }}
          min={1}
          // onChange={() => {
          //   const array = [...form.getFieldValue('bankAccount')]
          //   setCurrentAccountArray(array)
          // }}
        />
      </Form.Item>

in the code above you can see that I am forcefully updating the state of currentAccountArray, I want to execute this after the value is completely changed instead of onChange, which executes on every key press...

is there a way I can achieve this? I do not want to use onEnterPressed.

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

0

Maybe use onInput instead of onChange? -- OR -- Maybe a delayed call wrapped in a closure?

function setCurrentAccountArray(arr){
    // whatever your doing here
    console.log("hi", arr)
}

var TO_later;
function delayedCall(fn, arg, delay){
    clearTimeout(TO_later);
    TO_later = setTimeout((function(Vfn, Varg){
        return function(){
            Vfn(Varg);
        }
    })(fn, arg), delay);
}

<Form.Item
    label="Amount"
    name={[index, 'amount']}
>
<InputNumber
    style={{ width: '100%' }}
    min={1}
    onChange={() => {
        const array = [...form.getFieldValue('bankAccount')]
        delayedCall(setCurrentAccountArray, array, 300)
    }}
/>
</Form.Item>
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