The text renders with extra vertical space / wrong wrapping compared to the actual content size. In the screenshot, the red background shows the measured container area is larger than expected.
To Reproduce
import { PixelRatio, View } from "react-native";
import { EnrichedMarkdownText } from "react-native-enriched-markdown";
const markdownB = `, it emphasizes higher goals requires a fundamental change in thinking and effort rather than working more odntly emphasizes that reaching higher goals a fundamental change in thinking and effort rather than simply working more hours. fields, it consistently that reaching higher goals fundamental change in thinking and effort rather than simply working more hours.`;
export default function PartsPlayground() {
return (
<View className="flex-1 bg-background p-4 pt-safe">
<EnrichedMarkdownText
containerStyle={{
backgroundColor: "red",
width: 379,
}}
flavor="github"
markdown={markdownB}
/>
</View>
);
}
See result
Expected behavior
A text measured without blank line at the end
Fast (client side) workaround fix
containerStyle={{
backgroundColor: "red",
width: PixelRatio.roundToNearestPixel(containerWidth),
}}
Tested workaround on a fixture which generates 600 blocks of random markdown and the issue is not reproduced.
So it looks like Android text measurement is sensitive to non-rounded / fractional device physical pixel width.
Device (please complete the following information):
- Device: Pixel 9a (real and emulator)
- OS: Android 16
- Version 16
The text renders with extra vertical space / wrong wrapping compared to the actual content size. In the screenshot, the red background shows the measured container area is larger than expected.
To Reproduce
See result
Expected behavior
A text measured without blank line at the end
Fast (client side) workaround fix
Tested workaround on a fixture which generates 600 blocks of random markdown and the issue is not reproduced.
So it looks like Android text measurement is sensitive to non-rounded / fractional device physical pixel width.
Device (please complete the following information):