react-native/React
Luke Miles da9a712a9e Add a injectJavaScript method to the WebView component
Summary:
Currently, < WebView > allows you to pass JS to execute within the view. This works great, but there currently is not a way to execute JS after the page is loaded. We needed this for our app.

We noticed that the WebView had messaging support added (see #9762) . Initially, this seemed like more than enough functionality for our use case - just write a function that's injected on initial load that accepts a message with JS, and `eval()` it. However, this broke once we realized that Content Security Policy can block the use of eval on pages. The native methods iOS provide to inject JS allow you to inject JS without CSP interfering. So, we just wrapped the native methods on iOS (and later Android) and it worked for our use case. The method injectJavaScript was born.

Now, after I wrote this code, I realized that #8798 exists and hadn't been merged because of a lack of tests. I commend what was done in #8798 as it sorely solves a problem (injecting JS after the initial load) and has more features than what I'
Closes https://github.com/facebook/react-native/pull/11358

Differential Revision: D4390425

fbshipit-source-id: 02813127f8cf60fd84229cb26eeea7f8922d03b3
2017-01-06 20:29:02 -08:00
..
Base More accurate touch bookkeeping in RCTTouchHandler 2017-01-04 14:43:40 -08:00
Executors Fix JSGlobalContext leak 2016-12-12 05:43:34 -08:00
Modules Fix for dimensions not updating correctly on iPad due to screen rotation 2016-12-19 14:58:54 -08:00
Profiler Make React Profiler asm position independent 2016-12-08 14:58:26 -08:00
React.xcodeproj Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
Views Add a injectJavaScript method to the WebView component 2017-01-06 20:29:02 -08:00