fix: split manual links when newline inserted in link#624
Open
kacperzolkiewski wants to merge 9 commits into
Open
fix: split manual links when newline inserted in link#624kacperzolkiewski wants to merge 9 commits into
kacperzolkiewski wants to merge 9 commits into
Conversation
kacperzolkiewski
commented
Jun 2, 2026
…ftware-mansion/react-native-enriched into @kacperzolkiewski/fix-onlink-detected
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses incorrect onLinkDetected behavior when a manually-inserted link is split across multiple lines by inserting newlines, ensuring link spans/events reflect the split segments correctly on both iOS and Android.
Changes:
- iOS: refreshes manual link metadata so
LinkData.textmatches the current text in the refreshed range. - Android: splits manual link spans when newline characters are inserted inside a manual link, and de-duplicates
onLinkDetectedusing(text, url, start, end)rather than just(text, url). - Example app: initializes
selectionstate with a non-undefined default.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ios/styles/LinkStyle.mm | Updates refreshed manual link metadata to use the current substring for LinkData.text. |
| ios/EnrichedTextInputView.mm | Avoids redundant/early active-style updates during text changes to prevent stale link detection. |
| apps/example/src/hooks/useEditorState.ts | Provides a default {start,end,text} selection value instead of undefined. |
| android/src/main/java/com/swmansion/enriched/textinput/utils/EnrichedSelection.kt | Improves link-detected event de-duping by including visible start/end offsets. |
| android/src/main/java/com/swmansion/enriched/textinput/styles/ParametrizedStyles.kt | Splits manual link spans on newline insertion and factors span-application into a helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes: #556
Test Plan
Run reproduction steps from issue: #556
Issue should be resolved
Screenshots / Videos
Screen.Recording.2026-06-02.at.12.24.28.mov
Compatibility
Checklist