From 46db1826c54decb806c8011ba2abe2a62ac0ddac Mon Sep 17 00:00:00 2001 From: Krzysztof Magiera Date: Fri, 24 Apr 2015 11:58:31 -0700 Subject: [PATCH] [react_native] JS files from D2017699: Expose JavaScriptEnabled property for WebView component on android. --- Examples/UIExplorer/WebViewExample.js | 1 + Libraries/Components/WebView/WebView.android.js | 3 +++ Libraries/Components/WebView/WebView.ios.js | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Examples/UIExplorer/WebViewExample.js b/Examples/UIExplorer/WebViewExample.js index 8813a8afd..d1e990cb4 100644 --- a/Examples/UIExplorer/WebViewExample.js +++ b/Examples/UIExplorer/WebViewExample.js @@ -94,6 +94,7 @@ var WebViewExample = React.createClass({ automaticallyAdjustContentInsets={false} style={styles.webView} url={this.state.url} + javaScriptEnabledAndroid={true} onNavigationStateChange={this.onNavigationStateChange} startInLoadingState={true} /> diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index bfc823f9f..959422bbc 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -42,6 +42,7 @@ var WebView = React.createClass({ onNavigationStateChange: PropTypes.func, startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load style: View.propTypes.style, + javaScriptEnabledAndroid: PropTypes.bool, /** * Used to locate this view in end-to-end tests. */ @@ -90,6 +91,7 @@ var WebView = React.createClass({ key="webViewKey" style={webViewStyles} url={this.props.url} + javaScriptEnabledAndroid={this.props.javaScriptEnabledAndroid} contentInset={this.props.contentInset} automaticallyAdjustContentInsets={this.props.automaticallyAdjustContentInsets} onLoadingStart={this.onLoadingStart} @@ -157,6 +159,7 @@ var WebView = React.createClass({ var RCTWebView = createReactIOSNativeComponentClass({ validAttributes: merge(ReactIOSViewAttributes.UIView, { url: true, + javaScriptEnabledAndroid: true, }), uiViewClassName: 'RCTWebView', }); diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index c4e4fbcd3..ed2c98fae 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -92,6 +92,10 @@ var WebView = React.createClass({ onNavigationStateChange: PropTypes.func, startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load style: View.propTypes.style, + /** + * Used for android only, JS is enabled by default for WebView on iOS + */ + javaScriptEnabledAndroid: PropTypes.bool, }, getInitialState: function() {