software-mansion / software-mansion/react-native-enriched-html

onLinkDetected invalid behavior when splitting a link over multiple lines

Open
#556 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Maintainer issue
Dominant language
C
Stars
1.4k
Forks
66
Avg merge
4d 19h
Merged PRs (30d)
11

Description

Describe the bug
If we create a link, and then split it across many lines by pressing enter the html output shows we have a couple of seperate link elements. But:

  • on Android onLinkDetected treats those multiple links as a single one
  • on iOS we treat those links as seperate but the text attribute is invalid, it returns the link text before splitting it.

To Reproduce
Steps to reproduce the behavior:

  1. In useEditorState.ts set
  const handleLinkDetected = (state: CurrentLinkState) => {
    console.log('link detected', state);
    setCurrentLink(state);
  };
  1. Launch example app
  2. Add an example link
  3. Repeatedly press enter in the middle of the link to split it across multiple lines.
  4. On Android onLinkDetected treats those multiple links as a single one. On iOS the text attribute is wrong, it tells us the link text before splitting.

Expected behavior
On Android onLinkDetected shouldn't treat those multiple links as one. On iOS text should return substrings in the video example H, 'e', l, l, 'o`
Screenshots

https://github.com/user-attachments/assets/27125c21-6aee-4529-bd93-840c0ba35990

Device (please complete the following information):

  • Device: iPhone 17, Pixel 9
  • OS: iOS 26.2, Android 16
  • Version -, API 36 "Baklava"

Additional context
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the example app and reproduce the behavior using the handleLinkDetected code in useEditorState.ts. Compare onLinkDetected results on Android and iOS when a link is split across lines, then verify that Android reports separate links and iOS returns the text substring for each resulting link element.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.