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

110
Visualizações
Why are requests not getting blocked in my react-native web-view through the onShouldStartLoadWithRequest function?

I am trying to block content in a react-native web view using the onShouldStartLoadWithRequest function. I use async functions for the engine that decides whether or not to block a specific request. Since I am using an async function to load the engine and need to return a boolean to the onShouldStartLoadWithRequest function, I ended up using the .then method to pass the engine variable to my function that uses it. However, when I test this out, no requests are getting blocked. I tried logging the code ran in the .then method in the console to see what is going on and I did end up getting a boolean. However, when I tried another random async function that always returns false(it will always block content), that didn't work either(with a normal function it did work), so I feel like I am not handling the async functions correctly somehow. Here is my applicable code. In the end I am trying to return a boolean, is that not what is happening in the onShouldStartLoadWithRequest function?

//This is my loading function - it is located outside of the onShouldStartLoadWithRequest function
 async function loadEngine() {
    let engine = await FiltersEngine.fromPrebuiltAdsAndTracking(fetch);
    return engine
  }
//This is my onShouldStartLoadWithRequest function
 onShouldStartLoadWithRequest={(WebViewRequest) => {
          function useEngine(requestURLS, engine) {
            const {
              match
            } = engine.match(Request.fromRawDetails({
              url: requestURLS,
            }))
            let final_output;
            final_output = !match
            return final_output
          }
          return loadEngine().then((engine) => (useEngine(WebViewRequest.url, engine)))
        }}
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