diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3678735b5c..6b79acce83 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ diff --git a/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java b/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java index 72f0451e60..5ac9c524f5 100644 --- a/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java +++ b/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java @@ -219,6 +219,7 @@ public void setFontSize(ReactAztecText view, float fontSize) { view.setTextSize( TypedValue.COMPLEX_UNIT_PX, (int) Math.ceil(PixelUtil.toPixelFromSP(fontSize))); + view.refreshText(); } @ReactProp(name = ViewProps.FONT_FAMILY) diff --git a/react-native-aztec/src/AztecView.js b/react-native-aztec/src/AztecView.js index 9b7aca7adc..456be1a130 100644 --- a/react-native-aztec/src/AztecView.js +++ b/react-native-aztec/src/AztecView.js @@ -1,7 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; -import ReactNative, {requireNativeComponent, ViewPropTypes, UIManager, ColorPropType, TouchableWithoutFeedback, Platform} from 'react-native'; +import ReactNative, {requireNativeComponent, ViewPropTypes, UIManager, ColorPropType, TouchableWithoutFeedback, Platform, Dimensions} from 'react-native'; import TextInputState from 'react-native/lib/TextInputState'; +import { getScaledFontSize } from './utils'; const AztecManager = UIManager.getViewManagerConfig('RCTAztecView'); @@ -32,6 +33,23 @@ class AztecView extends React.Component { ...ViewPropTypes, // include the default view properties } + constructor() { + super(); + this.state = { fontScale: Dimensions.get('window').fontScale }; + } + + _onDimensionsChange = dimensions => { + this.setState({ fontScale: dimensions.window.fontScale }); + } + + componentWillMount() { + Dimensions.addEventListener('change', this._onDimensionsChange); + } + + componentWillUnmount() { + Dimensions.removeEventListener('change', this._onDimensionsChange); + } + dispatch(command, params) { params = params || []; UIManager.dispatchViewManagerCommand( @@ -149,11 +167,12 @@ class AztecView extends React.Component { } render() { - const { onActiveFormatsChange, onFocus, ...otherProps } = this.props + const { onActiveFormatsChange, onFocus, fontSize, ...otherProps } = this.props return (