Skip to content

Commit

Permalink
WebView: Allow to change textZoom on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
nvbn committed Aug 1, 2017
1 parent cb31356 commit b1df0dd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Libraries/Components/WebView/WebView.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ class WebView extends React.Component {
* @platform android
*/
saveFormDataDisabled: PropTypes.bool,

/**
* Text zoom of the page in percent, used on Android only. The default is 100.
* @platform android
*/
textZoom: PropTypes.number,
};

static defaultProps = {
Expand Down Expand Up @@ -276,6 +282,7 @@ class WebView extends React.Component {
allowUniversalAccessFromFileURLs={this.props.allowUniversalAccessFromFileURLs}
mixedContentMode={this.props.mixedContentMode}
saveFormDataDisabled={this.props.saveFormDataDisabled}
textZoom={this.props.textZoom}
/>;

return (
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ class WebView extends React.Component {
'always',
'compatibility'
]),

/**
* Text zoom of the page in percent, used on Android only. The default is 100.
* @platform android
*/
textZoom: PropTypes.number,
};

static defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,11 @@ public void setMixedContentMode(WebView view, @Nullable String mixedContentMode)
}
}

@ReactProp(name = "textZoom")
public void setTextZoom(WebView view, int textZoom) {
view.getSettings().setTextZoom(textZoom);
}

@Override
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
// Do not register default touch emitter and let WebView implementation handle touches
Expand Down

0 comments on commit b1df0dd

Please sign in to comment.