diff --git a/Examples/UIExplorer/WebViewExample.js b/Examples/UIExplorer/WebViewExample.js index d1e990cb4..6a93f80e6 100644 --- a/Examples/UIExplorer/WebViewExample.js +++ b/Examples/UIExplorer/WebViewExample.js @@ -43,6 +43,7 @@ var WebViewExample = React.createClass({ backButtonEnabled: false, forwardButtonEnabled: false, loading: true, + scalesPageToFit: true, }; }, @@ -97,6 +98,7 @@ var WebViewExample = React.createClass({ javaScriptEnabledAndroid={true} onNavigationStateChange={this.onNavigationStateChange} startInLoadingState={true} + scalesPageToFit={this.state.scalesPageToFit} /> {this.state.status} @@ -124,6 +126,7 @@ var WebViewExample = React.createClass({ url: navState.url, status: navState.title, loading: navState.loading, + scalesPageToFit: true }); }, diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index 83af4a8ad..15ab9e676 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -95,6 +95,11 @@ var WebView = React.createClass({ * Used for android only, JS is enabled by default for WebView on iOS */ javaScriptEnabledAndroid: PropTypes.bool, + /** + * Used for iOS only, sets whether the webpage scales to fit the view and the + * user can change the scale + */ + scalesPageToFit: PropTypes.bool, }, getInitialState: function() { @@ -155,6 +160,7 @@ var WebView = React.createClass({ onLoadingStart={this.onLoadingStart} onLoadingFinish={this.onLoadingFinish} onLoadingError={this.onLoadingError} + scalesPageToFit={this.props.scalesPageToFit} />; return ( diff --git a/React/Views/RCTWebViewManager.m b/React/Views/RCTWebViewManager.m index 50659a562..a5de572bd 100644 --- a/React/Views/RCTWebViewManager.m +++ b/React/Views/RCTWebViewManager.m @@ -30,6 +30,7 @@ RCT_REMAP_VIEW_PROPERTY(scrollEnabled, _webView.scrollView.scrollEnabled, BOOL); RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets); RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL); RCT_EXPORT_VIEW_PROPERTY(shouldInjectAJAXHandler, BOOL); +RCT_REMAP_VIEW_PROPERTY(scalesPageToFit, _webView.scalesPageToFit, BOOL); - (NSDictionary *)constantsToExport {