Skip to content

Commit

Permalink
Fix scalesPageToFit default property for iOS WebView.
Browse files Browse the repository at this point in the history
Summary:
`scalesPageToFit`'s [documented default value is true](https://github.com/facebook/react-native/blob/master/Libraries/Components/WebView/WebView.ios.js#L318), but it's not explicitly set anywhere on iOS. On Android it's [set to true in defaultProps](https://github.com/facebook/react-native/blob/master/Libraries/Components/WebView/WebView.android.js#L203). This pull-request add the default behaviour.

```
import { WebView } from 'react-native;
/* ... */
<WebView source={{ uri: 'https://google.com' }} />
```

You should be able to zoom in and out using the pinch gesture.

1. Does the reviewer have any additional thoughts around the rest of the defaultProps which aren't explicitly set?
2. Does the reviewer have any additional thoughts on how these two components (iOS/ Android) can share more code?
Closes #14363

Differential Revision: D5345883

Pulled By: shergin

fbshipit-source-id: e7b9b89f13d6adcdc705244871e00b7a5da52c64
  • Loading branch information
peterp authored and facebook-github-bot committed Jun 29, 2017
1 parent 16747dd commit 1859486
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ class WebView extends React.Component {
]),
};

static defaultProps = {
scalesPageToFit: true,
};

state = {
viewState: WebViewState.IDLE,
lastErrorEvent: (null: ?ErrorEvent),
Expand Down

0 comments on commit 1859486

Please sign in to comment.