0

I have a window variable accessible in my webview like window.x Android/iOS is changing the value of x based on certain conditions, problem is this value changes but react is not able to rerender based on said change since its not a state.

Is there any way to fire a callback when this value changes without polling it continuously?

Amartya Mishra
  • 145
  • 3
  • 7
  • If you know which function is changing the variable, you can hook into it and add handler that runs after it. Something like [this](https://stackoverflow.com/questions/10273309/need-to-hook-into-a-javascript-function-call-any-way-to-do-this) – Brother58697 Jan 05 '23 at 08:34
  • @Brother58697 the code triggering the variable change is running in Android/iOS native code, can I trigger an event in react from native code via a method channel or something? – Amartya Mishra Jan 05 '23 at 13:12

1 Answers1

0

Found a better way to communicate events to a webview running on Android/iOS, requires minor changes to native code.

How to trigger webview events from native code

Amartya Mishra
  • 145
  • 3
  • 7