Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
React Native Web view click detection

has anyone worked with web view click detection feature? Have a web view loading a site where I need to detect the click by user on a button. I tried using injected javascript but couldn't achieve the desired result. Here is my code

<WebView scalesPageToFit
    startInLoadingState
    originWhitelist={['*']}
    style={{ flex: 1 }} source={{ uri: url  }}
    javaScriptEnabled={true}
    domStorageEnabled={true}
    setSupportMultipleWindows={false}
    /> 

How will we add support for click event ? Do we need to change backend or we can handle on front end ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I solved the issue with below code. This is working for me and detecting click inside html :

import { WebView } from 'react-native-webview';

export default function App() {

const html = `
 <html>
   <body style='color:red'>
     This is a test
     <input type="button" value="Click me" onclick="msg()">
     <script>
         function msg() {
           setTimeout(function () {
             window.ReactNativeWebView.postMessage("Hello!")
           }, 2000)
         }
       </script>
   </body>
 </html>
 `;

return (
 <View style={styles.container}>
   <StatusBar style="auto" />
   <WebView
       source={{ html }}
       style={{width:400,height:200,backgroundColor:'white',marginTop:20}}
       onMessage={event => {
         alert(event.nativeEvent.data);
       }}
     />
 </View>
);
}


about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda