mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-08 09:12:05 +08:00
Fix WebView example on iOS
Summary: Fixed broken scaling logic in Webview example for iOS. Pages must be reloaded after toggling `scalesPageToFit`, but that wasn't happening. Reviewed By: javache Differential Revision: D2982371 fb-gh-sync-id: 8442609179bfe9ade10d1d0bac1807e4a8855d00 shipit-source-id: 8442609179bfe9ade10d1d0bac1807e4a8855d00
This commit is contained in:
committed by
Facebook Github Bot 7
parent
f7df3bb78a
commit
7032a640e7
@@ -163,7 +163,7 @@ var WebViewExample = React.createClass({
|
||||
|
||||
var Button = React.createClass({
|
||||
_handlePress: function() {
|
||||
if (this.props.enabled && this.props.onPress) {
|
||||
if (this.props.enabled !== false && this.props.onPress) {
|
||||
this.props.onPress();
|
||||
}
|
||||
},
|
||||
@@ -182,19 +182,19 @@ var ScaledWebView = React.createClass({
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
scalingEnabled: true
|
||||
scalingEnabled: true,
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<View style={{height:120}}>
|
||||
<View>
|
||||
<WebView
|
||||
style={{
|
||||
backgroundColor: BGWASH,
|
||||
height: 100,
|
||||
height: 200,
|
||||
}}
|
||||
source={{html: HTML}}
|
||||
source={{uri: 'https://facebook.github.io/react/'}}
|
||||
scalesPageToFit={this.state.scalingEnabled}
|
||||
/>
|
||||
<View style={styles.buttons}>
|
||||
@@ -307,7 +307,7 @@ const HTML = `
|
||||
<head>
|
||||
<title>Hello Static World</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=640, user-scalable=no">
|
||||
<meta name="viewport" content="width=320, user-scalable=no">
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
@@ -337,6 +337,10 @@ exports.examples = [
|
||||
title: 'Simple Browser',
|
||||
render(): ReactElement { return <WebViewExample />; }
|
||||
},
|
||||
{
|
||||
title: 'Scale Page to Fit',
|
||||
render(): ReactElement { return <ScaledWebView/>; }
|
||||
},
|
||||
{
|
||||
title: 'Bundled HTML',
|
||||
render(): ReactElement {
|
||||
@@ -367,10 +371,6 @@ exports.examples = [
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Scale Page to Fit',
|
||||
render(): ReactElement { return <ScaledWebView/>; }
|
||||
},
|
||||
{
|
||||
title: 'POST Test',
|
||||
render(): ReactElement {
|
||||
|
||||
Reference in New Issue
Block a user