feat(iOS): custom style - #641
kacperzolkiewski wants to merge 22 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an iOS-only “custom style” layer to support per-range foreground/background colors, including native commands/state events and HTML span parsing/serialization.
Changes:
- Exposes a new
setStyleimperative command and emitscustomStylein state/context-menu events. - Implements iOS
CustomStyle/CustomStyleDatato apply per-range colors and integrates it into style application priority. - Parses
<span style="color: ...; background-color: ...">into native style data and serializes custom styles back to HTML.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/useOnChangeState.ts | Adds default customStyle fields to the web state shape. |
| src/web/EnrichedTextInput.tsx | Adds a setStyle no-op to the web imperative handle. |
| src/types.ts | Extends public TS types with customStyle and setStyle(...). |
| src/spec/EnrichedTextInputNativeComponent.ts | Adds customStyle to events and introduces the setStyle native command in the codegen spec. |
| src/native/EnrichedTextInput.tsx | Implements setStyle command payload creation (processColor + JSON). |
| ios/utils/StyleUtils.mm | Registers CustomStyle in conflict/blocking maps and style registries. |
| ios/textHtmlParser/TextHtmlParser.mm | Applies CustomStyle when processing styles from HTML (viewer path). |
| ios/styles/EnrichedTextStyles.mm | Adds EnrichedTextCustomStyle implementation hook. |
| ios/styles/CustomStyle.mm | New iOS style implementation applying fg/bg colors via attributed text. |
| ios/interfaces/StyleTypeEnum.h | Adds Custom style type. |
| ios/interfaces/StyleHeaders.h | Declares CustomStyle interface in shared style headers. |
| ios/interfaces/StyleBase.mm | Introduces stylePriority default implementation. |
| ios/interfaces/StyleBase.h | Exposes stylePriority on the base style protocol. |
| ios/interfaces/EnrichedTextStyleHeaders.h | Adds EnrichedTextCustomStyle header. |
| ios/inputHtmlParser/InputHtmlParser.mm | Applies CustomStyle when processing styles from HTML (input path). |
| ios/inputAttributesManager/InputAttributesManager.mm | Changes style application ordering to use stylePriority. |
| ios/htmlParser/HtmlParser.mm | Parses/serializes custom styles as <span style="..."> and splits spans when data changes. |
| ios/extensions/ColorExtension.mm | Adds rgba string conversion + rgba parsing helpers. |
| ios/extensions/ColorExtension.h | Declares rgba helpers in the UIColor category. |
| ios/EnrichedTextInputView.mm | Implements setStyle command handling and emits customStyle in events. |
| ios/customStyleData/CustomStyleData.mm | New data object storing fg/bg UIColors with merge/equality/copy. |
| ios/customStyleData/CustomStyleData.h | Declares CustomStyleData API. |
| apps/example/src/constants/editorConfig.ts | Extends example default editor state with customStyle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hejsztynx
left a comment
There was a problem hiding this comment.
Functionally looks great!
…feat-custom-style
…ware-mansion/react-native-enriched into @kacperzolkiewski/feat-custom-style
| @[ @([LinkStyle getType]), @([MentionStyle getType]) ], | ||
| @([CustomStyle getType]) : @[] |
There was a problem hiding this comment.
why do images conflict with the fg/bg color? I think there's nothing stopping these working together.
There was a problem hiding this comment.
Wait, but images don't have a CustomStyle set as conflicting/blocking?
| @([ImageStyle getType]) : @[ @([InlineCodeStyle getType]) ], | ||
| @([CustomStyle getType]) : @[] |
There was a problem hiding this comment.
Here as well, I don't see why image can't be used within fg/bg color.



Summary
Add custom style for foreground and background colors handling
Test Plan
Run the example app and experiment with applying foreground and background colors through the toolbar across different text styles.
Screenshots / Videos
Screen.Recording.2026-06-17.at.13.38.30.mov
Compatibility
Checklist