-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Text element onLayout gives wrong dimensions on iOS with New Achitecture RN 0.76 #2544
Labels
Comments
I had the same problem on React Native New Architecture iOS. Measuring a |
<View
style={{
width: textSize ? textSize.width : 0,
height: textSize.height ? textSize.height : 0,
opacity: textSize ? 1 : 0,
borderWidth: 4,
borderColor: red,
}}
...
>
<Svg width="150" height="14">
<Text
dx={1 + 10}
dy={10}
fontSize={12}
fontWeight="800"
fontFamily="Onest-SemiBold"
textAnchor="start"
stroke="rgba(0, 0, 0, 1)"
strokeWidth={2}
strokeOpacity={0.75}
onLayout={(e) => {
// same e.nativeEvent.layout
e.target.measure((x, y, width, height) => {
setTextSize({ width, height });
});
}}
>
{props.text}
</Text>
...
</Svg>
</View>
|
Same result, I get the width of the container here instead of the Text element |
Issue is still present in 15.10.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I use the
<Text>
element and add an onLayout callback, and get a width which is the entire available space, not the dimensions of the text itself.With new architecture - reports wrong width
Without new architecture - reports correct width
Steps to reproduce
Clone the repo, or try yourself with this code:
Snack or a link to a repository
https://github.com/esbenvb/rn-font-weight-issue
SVG version
15.9.0.
React Native version
0.76.2
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
Debug app & dev bundle
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: