Regression: Font properties aren't applied when changed
See original GitHub issueWhen font properties such as fontSize
are changed, the new value is not applied to the image. Note that if another non-font property is changed, such as fill
the new font properties are applied.
This effects version 6.3 and newer, but worked correctly in 6.2.2. Therefore, running this example on snack shows the expected behavior, since expo still uses 6.2.2:
// @flow
import React, { PureComponent } from "react";
import { View, Button } from "react-native";
import Svg, { Text } from "react-native-svg";
export default class extends PureComponent<
{},
{ fontSize: number, fill: string }
> {
state = {
fontSize: 20,
fill: "red"
};
_toggleFontSize = () => {
this.setState(({ fontSize }) => ({
fontSize: fontSize === 20 ? 40 : 20
}));
};
_toggleFontSizeAndFill = () => {
this.setState(({ fontSize, fill }) => ({
fontSize: fontSize === 20 ? 40 : 20,
fill: fill === "red" ? "blue" : "red"
}));
};
render() {
return (
<View>
<Svg
style={{ backgroundColor: "rgb(230, 230, 230)" }}
width={400}
height={200}
>
<Text
x={0}
y={100}
fill={this.state.fill}
fontSize={this.state.fontSize}
>
Some example text
</Text>
</Svg>
<View>
<Button onPress={this._toggleFontSize} title="Toggle Font Size" />
<Button
onPress={this._toggleFontSizeAndFill}
title="Toggle Font Size & Fill"
/>
</View>
</View>
);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Regression: Font properties aren't applied when changed #760
When font properties such as fontSize are changed, the new value is not applied to the image. Note that if another non-font property...
Read more >454340 - [Regression]: Selected font color is not retained after ...
Issue 454340: [Regression]: Selected font color is not retained after user selects font color and applies alignment/bullet.
Read more >html - Font family does not change in the output - Stack Overflow
There is no change at all in h1, that I had applied it to. Following is my HTML code: <h1 align="center" class="login ...
Read more >5.3 - The Multiple Linear Regression Model | STAT 462
If the null hypothesis above were the case, then a change in the value of x_{1} would not change y, so y and...
Read more >Change Font in Comments (Writer 4.1.04) - Ask LibreOffice
Crunchbang 11, v3.5.7.2: It is only possible to set the bold/italic/underline attribute in a comment but not Font name or Font size. Set...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s part of this PR https://github.com/react-native-community/react-native-svg/pull/757 It’s in my fork in the NativeAnimationExperiment branch. As I haven’t merged the PR it’s not visible in any branch of this repo yet. Good to know it works! 👍
I’ve release the fixes, latest version now is v7.0.1 This can probably closed now.