react-native/React/Views
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
..
RCTActivityIndicatorView.h Fixes ActivityIndicatorIOS doesn't hide initially 2016-06-27 17:13:27 -07:00
RCTActivityIndicatorView.m Fixes ActivityIndicatorIOS doesn't hide initially 2016-06-27 17:13:27 -07:00
RCTActivityIndicatorViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTActivityIndicatorViewManager.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTAnimationType.h [LayoutAnimation] RCTAnimationTypeKeyboard 2015-06-25 09:17:01 -08:00
RCTAutoInsetsProtocol.h Automatically adjust content inset after view controller did layout subviews 2015-09-04 07:00:21 -08:00
RCTBorderDrawing.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTBorderDrawing.m Fixed border smearing issue 2016-01-07 12:03:17 -08:00
RCTBorderStyle.h Add property mapping for `borderStyle` from JS to `RCTView` (iOS) 2015-12-01 09:00:28 -08:00
RCTComponent.h Test building with clang 3.9 2016-08-10 13:13:34 -07:00
RCTComponentData.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTComponentData.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTConvert+CoreLocation.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTConvert+CoreLocation.m [MapView] Support for annotation callouts, annotation press, callout presses and pin animation 2015-06-25 09:15:21 -08:00
RCTConvert+MapKit.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTConvert+MapKit.m Implement draggable annotations on MapView. Closes #2512 2016-01-04 06:38:30 -08:00
RCTDatePicker.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTDatePicker.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTDatePickerManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTDatePickerManager.m Removed exported constants for fixed-size views 2016-04-26 04:21:39 -07:00
RCTFont.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTFont.mm If no match return at least the first font in the family. 2016-11-07 17:14:02 -08:00
RCTMap.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTMap.m Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK 2016-07-07 12:44:14 -07:00
RCTMapAnnotation.h Cleanup warnings 2016-07-12 05:59:12 -07:00
RCTMapAnnotation.m Add Polyline support to MapView 2015-11-26 08:54:16 -08:00
RCTMapManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTMapManager.m Add in support for showing annotation callouts by default without the user clicking on the pins 2016-11-20 00:58:28 -08:00
RCTMapOverlay.h Add Polyline support to MapView 2015-11-26 08:54:16 -08:00
RCTMapOverlay.m Add Polyline support to MapView 2015-11-26 08:54:16 -08:00
RCTModalHostView.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTModalHostView.m Apple TV support 1: existing Objective C code should compile for tvOS 2016-09-27 06:28:33 -07:00
RCTModalHostViewController.h Apple TV support 1: existing Objective C code should compile for tvOS 2016-09-27 06:28:33 -07:00
RCTModalHostViewController.m Apple TV support 2: Xcode projects and CI (scripts/objc-test.sh) 2016-10-05 07:28:44 -07:00
RCTModalHostViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTModalHostViewManager.m Allow <Modal /> to be presented in different orientations 2016-09-07 13:10:11 -07:00
RCTNavItem.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTNavItem.m NavigatorIOS System Icon Support 2016-09-08 17:58:50 -07:00
RCTNavItemManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTNavItemManager.m NavigatorIOS System Icon Support 2016-09-08 17:58:50 -07:00
RCTNavigator.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTNavigator.m reverted view clipping changes 2016-11-18 14:43:31 -08:00
RCTNavigatorManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTNavigatorManager.m NavigatorIOS: Expose interactivePopGestureEnabled property 2016-05-06 03:18:20 -07:00
RCTPicker.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTPicker.m Fix iOS Picker Item Colors 2016-12-03 18:58:29 -08:00
RCTPickerManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTPickerManager.m Improve types in RCTFont API 2016-08-05 12:44:21 -07:00
RCTPointerEvents.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTProgressViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTProgressViewManager.m Apple TV support 1: existing Objective C code should compile for tvOS 2016-09-27 06:28:33 -07:00
RCTRefreshControl.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTRefreshControl.m RefreshControl doesn't render when initial refreshing state is true 2016-11-07 15:58:43 -08:00
RCTRefreshControlManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTRefreshControlManager.m Allow to set refresh control title color 2016-04-16 15:15:25 -07:00
RCTRootShadowView.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTRootShadowView.m Rename C api 2016-12-03 04:44:10 -08:00
RCTScrollView.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTScrollView.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTScrollViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTScrollViewManager.m Rename enums 2016-12-02 05:58:45 -08:00
RCTScrollableProtocol.h Remove deprecated nativeScrollDelegate property 2016-07-11 13:34:02 -07:00
RCTSegmentedControl.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTSegmentedControl.m Added lightweight generic annotations 2015-11-03 14:49:30 -08:00
RCTSegmentedControlManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTSegmentedControlManager.m Removed exported constants for fixed-size views 2016-04-26 04:21:39 -07:00
RCTShadowView.h Rename directories 2016-12-07 05:14:12 -08:00
RCTShadowView.m Rely on yoga to enforces precedence rules 2017-01-06 06:43:45 -08:00
RCTSlider.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTSlider.m Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
RCTSliderManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTSliderManager.m Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
RCTSwitch.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTSwitch.m [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSwitchManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTSwitchManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTVView.h Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
RCTTVView.m Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
RCTTabBar.h Enable setting color of text and images on unselected tabs 2016-05-03 05:40:29 -07:00
RCTTabBar.m Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
RCTTabBarItem.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTTabBarItem.m Apple TV support 5: adjustments after manual import of #10427 2016-12-21 03:28:28 -08:00
RCTTabBarItemManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTTabBarItemManager.m Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
RCTTabBarManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTTabBarManager.m unselectedItemTintColor property available since iOS10 2016-11-29 12:28:55 -08:00
RCTTextDecorationLineType.h <Text> module add textDecoration style attributes 2015-07-07 06:15:20 -08:00
RCTView.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTView.m reverted view clipping changes 2016-11-18 14:43:31 -08:00
RCTViewControllerProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTViewManager.m Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
RCTWebView.h Add a injectJavaScript method to the WebView component 2017-01-06 20:29:02 -08:00
RCTWebView.m Add a injectJavaScript method to the WebView component 2017-01-06 20:29:02 -08:00
RCTWebViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTWebViewManager.m Add a injectJavaScript method to the WebView component 2017-01-06 20:29:02 -08:00
RCTWrapperViewController.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTWrapperViewController.m Apple TV support 1: existing Objective C code should compile for tvOS 2016-09-27 06:28:33 -07:00
UIView+Private.h reverted view clipping changes 2016-11-18 14:43:31 -08:00
UIView+React.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
UIView+React.m reverted view clipping changes 2016-11-18 14:43:31 -08:00