feat(iOS): add fontSize and fontFamily to customStyle - #754
kacperzolkiewski wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds iOS support for applying fontSize and fontFamily via the existing customStyle mechanism, wiring the new style properties through the JS API, native style application, and HTML import/export, plus updating the example app and Maestro flows to exercise the feature.
Changes:
- Extend
customStyle(events +setStyle) to includefontSizeandfontFamily. - Apply and round-trip custom font styling on iOS (native styling + HTML parser/serializer updates).
- Update example toolbar UI and add Maestro visual flows for custom font verification.
Reviewed changes
Copilot reviewed 15 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/useOnChangeState.ts | Adds default fontSize/fontFamily fields to web customStyle state payload. |
| src/types.ts | Extends public TS event and instance types to include fontSize/fontFamily. |
| src/spec/EnrichedTextInputNativeComponent.ts | Updates codegen spec event payloads to carry fontSize/fontFamily. |
| src/native/EnrichedTextInput.tsx | Extends setStyle command payload to send fontSize/fontFamily to native. |
| ios/styles/CustomStyle.mm | Applies font size/family overrides (including typing attrs) while preserving traits. |
| ios/htmlParser/HtmlParser.mm | Serializes/deserializes font-size/font-family within custom-style spans. |
| ios/EnrichedTextInputView.mm | Emits new fields in state/context-menu events and accepts them in setStyle. |
| ios/customStyleData/CustomStyleData.mm | Stores/merges/compares/hashes/copies fontSize/fontFamily in custom style data. |
| ios/customStyleData/CustomStyleData.h | Adds fontSize/fontFamily properties to custom style data model. |
| apps/example/src/constants/editorConfig.ts | Extends default example editor style state with font fields. |
| apps/example/src/components/Toolbar.tsx | Adds font size/family toolbar buttons and picker wiring. |
| apps/example/src/components/FontSizePickerRow.tsx | New example picker row for selecting/clearing font size. |
| apps/example/src/components/FontFamilyPickerRow.tsx | New example picker row for selecting/clearing font family. |
| .maestro/enrichedText/flows/custom_style_fonts_visual.yaml | Adds visual regression flow for HTML-driven custom font styles. |
| .maestro/enrichedInput/flows/custom_style_fonts_visual.yaml | Adds visual regression flow for interactive font size/family styling. |
Suppressed comments (1)
ios/customStyleData/CustomStyleData.mm:30
- An empty
fontFamilystring is treated as a non-empty custom style (since it’s non-nil), which causes unnecessary styling work and makes it easy for callers to accidentally “set” an empty family. Normalize empty strings tonilwhen merging.
id ffVal = dict[@"fontFamily"];
if (ffVal != nil) {
self.fontFamily =
[ffVal isKindOfClass:[NSString class]] ? (NSString *)ffVal : nil;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
hejsztynx
left a comment
There was a problem hiding this comment.
Overall looks great, but it seems like the custom style fonts does not respect system's accessibility settings, I think they should, wdyt?
Screen.Recording.2026-08-11.at.10.36.22.mov
|
|
||
| if (data.fontFamily.length > 0) { | ||
| resolvedFont = [RCTFont updateFont:resolvedFont | ||
| withFamily:data.fontFamily |
There was a problem hiding this comment.
I think we should handle a case when fontFamily can't be found, the method docs say:
/**
* Update a font with a given font-family, size, weight and style.
* If parameters are not specified, they'll be kept as-is.
* If font is nil, the default system font of size 14 will be used.
*/
So we could maybe guard the nil value and if it happens, just don't replace the font attribute to the system font of size 14 but rather keep whatever was before (+ emit some warning too). I think setting this random font will break our fonts flow.



Summary
Add fontSize and fontFamily to customStyle
Test Plan
Run example app and experiment with applying
fontSizeandfontFamilythrough the toolbar across different text styles.Screenshots / Videos
Screen.Recording.2026-08-10.at.11.38.35.mov
Compatibility
Checklist