0
Hello,
I can’t get JS to wait for the method to finish the execution before showing the return, someone can help me?
Method:
getValor(jogador) {
        const id_grupo = this.props.grupoSelected.id;
        if (jogador.financeiro) {
            const arrayFinanceiro = Object.keys(jogador.financeiro);
            if (arrayFinanceiro) {
                arrayFinanceiro.forEach((grupoKey) => {
                    if (grupoKey === id_grupo) {
                        return jogador.financeiro[grupoKey];
                    }
                });
            } else return 0;
        } else return 0;
    }
JSX:
<Text>{ this.getValor(jogador) }</Text>