1

I have an native mobile application that loads my react application within a child iframe (not sure exactly how it does it), but this application injects some variables into the page as windows.xxxx

So in order to test my application (yes, this sucks a lot) I need to run the app on my phone, have it open up the URL on my development machine (aka http://192.168.10.10:3300).

Then to debug anything I'm forced to alert(var1) .. as you can imagine this is a pretty painful process and I really wish the parent application would provide something better than this.

Normally a simple option would be something like console.log(var1) but I can't see the console on my mobile device and my URL is being loaded withing this native app.

So: 1. Any suggestions on a better debug process would be welcome.
2. One idea that would help is if there was a react component that would simply
print to screen anything any console.log().
3. I guess another option could be some kind of remote logger, so that console.remotelog(debugServerUrl, var1) pushes debug messages to the listener which then displays the debug.

All of this if a pain of course, but hoping someone out there has a clever idea for me.

Warrick FitzGerald
  • 2,455
  • 3
  • 23
  • 31

1 Answers1

0

If you're already using ReactJS, an easy quick-fix might be creating a log file in the phone. This post details a quick and relatively easy way to save a string as a text file, and it would not be hard to put everything you want saved into a string.

Furthermore, This post details an implementation of the remote logging feature you vaguely referenced.

Also, if you want to capture stdout and stderr, check out this npm package

Ultimately, hope this helps, and good luck

Carson
  • 2,700
  • 11
  • 24