bug: Markdown Image not rendering correctly
Describe the Bug
Image is rendering on top of the rest of the content.
Steps to Reproduce
- Apply the following code here https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/037253bdf26fde48e320f3a61350d8b343dfa090/app/containers/markdown/Markdown.stories.tsx#L134
- Inspect MarkdownImage on Storybook
const mdText = `${lineBreakText} `
export const Image = () => (
<View style={styles.container}>
<Markdown msg={mdText} />
<View style={{ height : 1, backgroundColor : 'red' }} />
<RNText>{lineBreakText} <RNImage source={{ uri: 'https://play.google.com/intl/en_us/badges/images/badge_new.png' }} style={{ width: 100, height: 100 }} /></RNText>
</View>
);
I've added a red line to display where Markdown ends and where the Text sample starts.
Expected Behavior
No response
Actual Behavior
Rocket.Chat Server Version
any
Rocket.Chat App Version
4.58.0
Device Name
any
OS Version
any
Additional Context
No response
Hi @diegolmello, I would love to work on this issue as part of my GSoC 2025 contribution! 🚀 I have experience in React Native, UI debugging, and frontend fixes.
Please assign me this issue, and I’ll begin working on a fix. Thanks!
@TapItNinja Hey! There's no assignment. Open a PR and we're going to review it. Thanks!
I'm unable to produce it using the storyboard. Please help me to provide more details about these bugs.
The issue has been fixed, and I have made the image height and width dynamic based on the remote image size.
Please review my PR and merge it. Here is a screenshot of the fixed screen.
It appears to be a bug on React Native, so we can't solve on our side alone.
At least not without refactoring and trying new things.
We would have to render inline images outside of a Text node that contains a lineHeight style.
https://github.com/facebook/react-native/issues/48727
Feel free to use this channel to test markdown https://open.rocket.chat/channel/markdown-parser
As a reference, if you comment this two lines on Markdown styles, you'll see the inline image rendering correctly
@diegolmello I would like to work on it..
Fabric doesn't seem to fix it https://github.com/RocketChat/Rocket.Chat.ReactNative/pull/6478#issuecomment-3141099169