aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/scaling_input.tsx
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-29 05:35:38 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-29 05:35:38 +0800
commit85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380 (patch)
treea99f46d1bcd90de7784f6ebc45784fdac3c66aaa /packages/instant/src/components/scaling_input.tsx
parent53f8e1b3b426424bf4459605b48e706eb7fb6d90 (diff)
downloaddexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.tar
dexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.tar.gz
dexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.tar.bz2
dexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.tar.lz
dexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.tar.xz
dexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.tar.zst
dexon-sol-tools-85d1dba1ef5ba4d34de46cb7eb54bfdc7acae380.zip
fix: notify of the used font size for re-renders of scaling input
Diffstat (limited to 'packages/instant/src/components/scaling_input.tsx')
-rw-r--r--packages/instant/src/components/scaling_input.tsx6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/instant/src/components/scaling_input.tsx b/packages/instant/src/components/scaling_input.tsx
index 129162a74..791692257 100644
--- a/packages/instant/src/components/scaling_input.tsx
+++ b/packages/instant/src/components/scaling_input.tsx
@@ -98,6 +98,12 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
inputWidthPx: this._getInputWidthInPx(),
};
}
+ public componentDidMount(): void {
+ // Trigger an initial notification of the calculated fontSize.
+ const currentPhase = ScalingInput.getPhaseFromProps(this.props);
+ const currentFontSize = ScalingInput.calculateFontSizeFromProps(this.props, currentPhase);
+ this.props.onFontSizeChange(currentFontSize);
+ }
public componentDidUpdate(
prevProps: ScalingInputProps,
prevState: ScalingInputState,