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

170
Visualizações
How can a React Native Android Java know if an addListener with a given name exists

I can solve the problem by using an additional flag that will get communicated from Javascript to Java. But an extra flag felt redundant to my taste. My Java native code needs to do something in its state and then notify the Javascript layer about this. But my concern is that, if the Javascript layer did not call the NativeEventEmitter::addListener, then the changes made on the Java native side won't get communicated to the Javascript side. So I first need to determine that Javascript is listening for this event. Otherwise, no state changes on the Java side.

Like I said, a trivial boolean flag and the extra native call to have this flag communicated to the Java side could solve this problem. But I worry that such extraneous method would cause things to go out-of-sync by accident, via javascript programming mistake. I, therefore, am inclined to check if Javascript is listening for the event. How can Java React Native find out if there is a listener?

about 4 years ago · Juan Pablo Isaza
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