Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView: Allow to change textZoom on Android #15311

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Libraries/Components/WebView/WebView.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ class WebView extends React.Component {
* @platform android
*/
urlPrefixesForDefaultIntent: PropTypes.arrayOf(PropTypes.string),

/**
* 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 @@ -318,6 +324,7 @@ class WebView extends React.Component {
mixedContentMode={this.props.mixedContentMode}
saveFormDataDisabled={this.props.saveFormDataDisabled}
urlPrefixesForDefaultIntent={this.props.urlPrefixesForDefaultIntent}
textZoom={this.props.textZoom}
{...nativeConfig.props}
/>;

Expand Down
8 changes: 7 additions & 1 deletion Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class WebView extends React.Component {
'always',
'compatibility'
]),

/**
* Override the native component used to render the WebView. Enables a custom native
* WebView which uses the same JavaScript as the original WebView.
Expand All @@ -398,6 +398,12 @@ class WebView extends React.Component {
*/
viewManager: PropTypes.object,
}),

/**
* 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 @@ -540,6 +540,11 @@ public void setUrlPrefixesForDefaultIntent(
}
}

@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