[WebView] Exposed scalesPageToFit UIWebView property
Summary: Added the ``scalesPageToFit`` prop to ``WebView``. This allows ``UIWebView`` to handle user zoom and scale. Closes https://github.com/facebook/react-native/pull/1631 Github Author: alvaromb <amedina@apsl.net> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
parent
6e3472d13e
commit
a48e9b4690
|
@ -43,6 +43,7 @@ var WebViewExample = React.createClass({
|
||||||
backButtonEnabled: false,
|
backButtonEnabled: false,
|
||||||
forwardButtonEnabled: false,
|
forwardButtonEnabled: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
|
scalesPageToFit: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -97,6 +98,7 @@ var WebViewExample = React.createClass({
|
||||||
javaScriptEnabledAndroid={true}
|
javaScriptEnabledAndroid={true}
|
||||||
onNavigationStateChange={this.onNavigationStateChange}
|
onNavigationStateChange={this.onNavigationStateChange}
|
||||||
startInLoadingState={true}
|
startInLoadingState={true}
|
||||||
|
scalesPageToFit={this.state.scalesPageToFit}
|
||||||
/>
|
/>
|
||||||
<View style={styles.statusBar}>
|
<View style={styles.statusBar}>
|
||||||
<Text style={styles.statusBarText}>{this.state.status}</Text>
|
<Text style={styles.statusBarText}>{this.state.status}</Text>
|
||||||
|
@ -124,6 +126,7 @@ var WebViewExample = React.createClass({
|
||||||
url: navState.url,
|
url: navState.url,
|
||||||
status: navState.title,
|
status: navState.title,
|
||||||
loading: navState.loading,
|
loading: navState.loading,
|
||||||
|
scalesPageToFit: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,11 @@ var WebView = React.createClass({
|
||||||
* Used for android only, JS is enabled by default for WebView on iOS
|
* Used for android only, JS is enabled by default for WebView on iOS
|
||||||
*/
|
*/
|
||||||
javaScriptEnabledAndroid: PropTypes.bool,
|
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() {
|
getInitialState: function() {
|
||||||
|
@ -155,6 +160,7 @@ var WebView = React.createClass({
|
||||||
onLoadingStart={this.onLoadingStart}
|
onLoadingStart={this.onLoadingStart}
|
||||||
onLoadingFinish={this.onLoadingFinish}
|
onLoadingFinish={this.onLoadingFinish}
|
||||||
onLoadingError={this.onLoadingError}
|
onLoadingError={this.onLoadingError}
|
||||||
|
scalesPageToFit={this.props.scalesPageToFit}
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -30,6 +30,7 @@ RCT_REMAP_VIEW_PROPERTY(scrollEnabled, _webView.scrollView.scrollEnabled, BOOL);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets);
|
RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL);
|
RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(shouldInjectAJAXHandler, BOOL);
|
RCT_EXPORT_VIEW_PROPERTY(shouldInjectAJAXHandler, BOOL);
|
||||||
|
RCT_REMAP_VIEW_PROPERTY(scalesPageToFit, _webView.scalesPageToFit, BOOL);
|
||||||
|
|
||||||
- (NSDictionary *)constantsToExport
|
- (NSDictionary *)constantsToExport
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue