feat(android): add minimum font size (#2279)
This commit is contained in:
parent
c42db6b614
commit
a12e231121
|
@ -646,6 +646,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "minimumFontSize")
|
||||
public void setMinimumFontSize(WebView view, int fontSize) {
|
||||
view.getSettings().setMinimumFontSize(fontSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
|
||||
// Do not register default touch emitter and let WebView implementation handle touches
|
||||
|
|
|
@ -83,6 +83,7 @@ This document lays out the current public properties and methods for the React N
|
|||
- [`basicAuthCredential`](Reference.md#basicAuthCredential)
|
||||
- [`enableApplePay`](Reference.md#enableApplePay)
|
||||
- [`forceDarkOn`](Reference.md#forceDarkOn)
|
||||
- [`minimumFontSize`](Reference.md#minimumFontSize)
|
||||
|
||||
## Methods Index
|
||||
|
||||
|
@ -1503,6 +1504,18 @@ An object that specifies the credentials of a user to be used for basic authenti
|
|||
| ------ | -------- |
|
||||
| object | No |
|
||||
|
||||
### `minimumFontSize`
|
||||
|
||||
Android enforces a minimum font size based on this value. A non-negative integer between 1 and 72. Any number outside the specified range will be pinned. Default value is 8. If you are using smaller font sizes and are having trouble fitting the whole window onto one screen, try setting this to a smaller value.
|
||||
|
||||
| Type | Required | Platform |
|
||||
| ------ | -------- | -------- |
|
||||
| number | No | Android |
|
||||
|
||||
Example:
|
||||
|
||||
`<WebView minimumFontSize={1} />`
|
||||
|
||||
## Methods
|
||||
|
||||
### `goForward()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
||||
|
|
|
@ -331,6 +331,7 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
|
|||
nestedScrollEnabled?: boolean;
|
||||
readonly urlPrefixesForDefaultIntent?: string[];
|
||||
forceDarkOn?: boolean;
|
||||
minimumFontSize?: number;
|
||||
}
|
||||
|
||||
export declare type ContentInsetAdjustmentBehavior = 'automatic' | 'scrollableAxes' | 'never' | 'always';
|
||||
|
@ -1055,6 +1056,14 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
|
|||
* @platform android
|
||||
*/
|
||||
nestedScrollEnabled?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the minimum font size.
|
||||
* A non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
|
||||
* Default is 8.
|
||||
* @platform android
|
||||
*/
|
||||
minimumFontSize?: number;
|
||||
}
|
||||
|
||||
export interface WebViewSharedProps extends ViewProps {
|
||||
|
|
Loading…
Reference in New Issue