From 97c327b36f81e27bc70fed2494b93199819193dd Mon Sep 17 00:00:00 2001 From: IvanIhnatsiuk Date: Mon, 3 Nov 2025 16:47:23 +0100 Subject: [PATCH 1/6] fix: add a check that the href attribute exists in link params --- ios/inputParser/InputParser.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ios/inputParser/InputParser.mm b/ios/inputParser/InputParser.mm index f27cecda5..ea2cacfba 100644 --- a/ios/inputParser/InputParser.mm +++ b/ios/inputParser/InputParser.mm @@ -597,10 +597,12 @@ - (NSArray *)getTextAndStylesFromHtml:(NSString *)fixedHtml { } else if([tagName isEqualToString:@"code"]) { [styleArr addObject:@([InlineCodeStyle getStyleType])]; } else if([tagName isEqualToString:@"a"]) { - [styleArr addObject:@([LinkStyle getStyleType])]; - // cut only the url from the href="..." string - NSString *url = [params substringWithRange:NSMakeRange(6, params.length - 7)]; - stylePair.styleValue = url; + [styleArr addObject:@([LinkStyle getStyleType])]; + NSRange hrefRange = [params rangeOfString:@"href="]; + if(hrefRange.location != NSNotFound) { + NSString *url = [params substringWithRange:NSMakeRange(6, params.length - 7)]; + stylePair.styleValue = url; + } } else if([tagName isEqualToString:@"mention"]) { [styleArr addObject:@([MentionStyle getStyleType])]; // extract html expression into dict using some regex From b8a24d31b0b5ae5c7eec0f8cdbc2be259e598d65 Mon Sep 17 00:00:00 2001 From: IvanIhnatsiuk Date: Wed, 5 Nov 2025 23:13:26 +0100 Subject: [PATCH 2/6] feat: add scrollEnabled prop --- .../java/com/swmansion/enriched/EnrichedTextInputView.kt | 9 +++++++++ .../swmansion/enriched/EnrichedTextInputViewManager.kt | 5 +++++ ios/EnrichedTextInputView.mm | 8 ++++++++ src/EnrichedTextInput.tsx | 3 +++ src/EnrichedTextInputNativeComponent.ts | 1 + 5 files changed, 26 insertions(+) diff --git a/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt b/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt index bae67e50b..dcca8fcd7 100644 --- a/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +++ b/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt @@ -54,6 +54,7 @@ class EnrichedTextInputView : AppCompatEditText { val parametrizedStyles: ParametrizedStyles? = ParametrizedStyles(this) var isDuringTransaction: Boolean = false var isRemovingMany: Boolean = false + var scrollEnabled = true val mentionHandler: MentionHandler? = MentionHandler(this) var htmlStyle: HtmlStyle = HtmlStyle(this, null) @@ -137,6 +138,14 @@ class EnrichedTextInputView : AppCompatEditText { return super.onTouchEvent(ev) } + override fun canScrollVertically(direction: Int): Boolean { + return scrollEnabled + } + + override fun canScrollHorizontally(direction: Int): Boolean { + return scrollEnabled + } + override fun onSelectionChanged(selStart: Int, selEnd: Int) { super.onSelectionChanged(selStart, selEnd) selection?.onSelection(selStart, selEnd) diff --git a/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt b/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt index 418c3fb2a..f1ddb4ec4 100644 --- a/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt +++ b/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt @@ -155,6 +155,11 @@ class EnrichedTextInputViewManager : SimpleViewManager(), view?.setFontStyle(style) } + @ReactProp(name = "scrollEnabled") + override fun setScrollEnabled(view: EnrichedTextInputView, scrollEnabled: Boolean) { + view.scrollEnabled = scrollEnabled + } + override fun onAfterUpdateTransaction(view: EnrichedTextInputView) { super.onAfterUpdateTransaction(view) view.updateTypeface() diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index c4882e1ca..56ce985f0 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -357,6 +357,10 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & stylePropChanged = YES; } + if(newViewProps.scrollEnabled != oldViewProps.scrollEnabled || textView.scrollEnabled != newViewProps.scrollEnabled) { + [self setScrollEnabled: newViewProps.scrollEnabled]; + } + folly::dynamic oldMentionStyle = oldViewProps.htmlStyle.mention; folly::dynamic newMentionStyle = newViewProps.htmlStyle.mention; if(oldMentionStyle != newMentionStyle) { @@ -862,6 +866,10 @@ - (void)tryEmittingOnChangeHtmlEvent { } } +-(void)setScrollEnabled:(bool)scrollEnabled { + [textView setScrollEnabled: scrollEnabled]; +} + // MARK: - Styles manipulation - (void)toggleRegularStyle:(StyleType)type { diff --git a/src/EnrichedTextInput.tsx b/src/EnrichedTextInput.tsx index 8ee4e2420..07f2d2fe2 100644 --- a/src/EnrichedTextInput.tsx +++ b/src/EnrichedTextInput.tsx @@ -130,6 +130,7 @@ export interface EnrichedTextInputProps extends Omit { autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'; htmlStyle?: HtmlStyle; style?: ViewStyle | TextStyle; + scrollEnabled?: boolean; onFocus?: () => void; onBlur?: () => void; onChangeText?: (e: NativeSyntheticEvent) => void; @@ -192,6 +193,7 @@ export const EnrichedTextInput = ({ onEndMention, onChangeSelection, androidExperimentalSynchronousEvents = false, + scrollEnabled = true, ...rest }: EnrichedTextInputProps) => { const nativeRef = useRef(null); @@ -352,6 +354,7 @@ export const EnrichedTextInput = ({ androidExperimentalSynchronousEvents={ androidExperimentalSynchronousEvents } + scrollEnabled={scrollEnabled} {...rest} /> ); diff --git a/src/EnrichedTextInputNativeComponent.ts b/src/EnrichedTextInputNativeComponent.ts index 34a9c5e39..e0b943201 100644 --- a/src/EnrichedTextInputNativeComponent.ts +++ b/src/EnrichedTextInputNativeComponent.ts @@ -135,6 +135,7 @@ export interface NativeProps extends ViewProps { selectionColor?: ColorValue; autoCapitalize?: string; htmlStyle?: HtmlStyleInternal; + scrollEnabled?: boolean; // event callbacks onInputFocus?: DirectEventHandler; From 48c68d54df4bb0e431d792036d51faffdf55ec3f Mon Sep 17 00:00:00 2001 From: IvanIhnatsiuk Date: Fri, 7 Nov 2025 13:16:58 +0100 Subject: [PATCH 3/6] fix: remove setScrollEnabledMethod --- ios/EnrichedTextInputView.mm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index 56ce985f0..3210cb96a 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -358,7 +358,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } if(newViewProps.scrollEnabled != oldViewProps.scrollEnabled || textView.scrollEnabled != newViewProps.scrollEnabled) { - [self setScrollEnabled: newViewProps.scrollEnabled]; + [textView setScrollEnabled: newViewProps.scrollEnabled]; } folly::dynamic oldMentionStyle = oldViewProps.htmlStyle.mention; @@ -866,10 +866,6 @@ - (void)tryEmittingOnChangeHtmlEvent { } } --(void)setScrollEnabled:(bool)scrollEnabled { - [textView setScrollEnabled: scrollEnabled]; -} - // MARK: - Styles manipulation - (void)toggleRegularStyle:(StyleType)type { From 17101777e4824125b40216991f8a74b1e90b1ae0 Mon Sep 17 00:00:00 2001 From: IvanIhnatsiuk Date: Fri, 7 Nov 2025 13:17:30 +0100 Subject: [PATCH 4/6] fix: add type for scrollEnabled --- .../main/java/com/swmansion/enriched/EnrichedTextInputView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt b/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt index dcca8fcd7..c655a674e 100644 --- a/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +++ b/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt @@ -54,7 +54,7 @@ class EnrichedTextInputView : AppCompatEditText { val parametrizedStyles: ParametrizedStyles? = ParametrizedStyles(this) var isDuringTransaction: Boolean = false var isRemovingMany: Boolean = false - var scrollEnabled = true + var scrollEnabled: Boolean = true val mentionHandler: MentionHandler? = MentionHandler(this) var htmlStyle: HtmlStyle = HtmlStyle(this, null) From be49825dfcf8fcb83304a52bf2f01bbf190a16ba Mon Sep 17 00:00:00 2001 From: Ivan Ihnatsiuk <86000012+IvanIhnatsiuk@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:28:21 +0100 Subject: [PATCH 5/6] fix: update spacing Co-authored-by: Tomasz Zawadzki --- ios/EnrichedTextInputView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index 3210cb96a..68c698dcf 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -358,7 +358,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } if(newViewProps.scrollEnabled != oldViewProps.scrollEnabled || textView.scrollEnabled != newViewProps.scrollEnabled) { - [textView setScrollEnabled: newViewProps.scrollEnabled]; + [textView setScrollEnabled:newViewProps.scrollEnabled]; } folly::dynamic oldMentionStyle = oldViewProps.htmlStyle.mention; From 4467366d170472323f6f17a9103c75dc1078bfee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Furga=C5=82a?= <74370735+exploIF@users.noreply.github.com> Date: Tue, 18 Nov 2025 10:35:33 +0100 Subject: [PATCH 6/6] chore: revert iOS parser changes --- ios/inputParser/InputParser.mm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ios/inputParser/InputParser.mm b/ios/inputParser/InputParser.mm index ea2cacfba..f27cecda5 100644 --- a/ios/inputParser/InputParser.mm +++ b/ios/inputParser/InputParser.mm @@ -597,12 +597,10 @@ - (NSArray *)getTextAndStylesFromHtml:(NSString *)fixedHtml { } else if([tagName isEqualToString:@"code"]) { [styleArr addObject:@([InlineCodeStyle getStyleType])]; } else if([tagName isEqualToString:@"a"]) { - [styleArr addObject:@([LinkStyle getStyleType])]; - NSRange hrefRange = [params rangeOfString:@"href="]; - if(hrefRange.location != NSNotFound) { - NSString *url = [params substringWithRange:NSMakeRange(6, params.length - 7)]; - stylePair.styleValue = url; - } + [styleArr addObject:@([LinkStyle getStyleType])]; + // cut only the url from the href="..." string + NSString *url = [params substringWithRange:NSMakeRange(6, params.length - 7)]; + stylePair.styleValue = url; } else if([tagName isEqualToString:@"mention"]) { [styleArr addObject:@([MentionStyle getStyleType])]; // extract html expression into dict using some regex