react-nativeiframewebview

Are messages a reliable way to send large amounts of data into and out of a web app in a React Native webview?


I am researching the viability of loading my existing web app in my React Native app while it is offline. Based on some older SO questions, it does seem possible. However, I also need know if its possible to do the three following things:

  1. Dynamically load roughly 2 MB of JSON data into the web app in the webview.
  2. Access Camera, file system, and geolocation in the web app.
  3. Send roughly 2 MB of JSON data and multiple photos back to the React Native app to be saved locally.

I know that iframes and the web view can send messages but as I understand it, that's generally used for sending URLs or other flags.

In short, the primary question is are messages a reliable way to send large amounts of data into and out of a web app in the webview (iframe) of React Native?


Solution

  • My experience of using the postMessage API, is between webpages, rather than an App. I have always found it to be reliable, but if something does go wrong then you don’t get any feedback. So if the data is important, you’ll need to build your own ACK layer on top of it.