feat(input): localize format & selection submenu labels#443
Open
eszlamczyk wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the localized-labels pattern used by EnrichedMarkdownText to the EnrichedMarkdownTextInput selection context menu, so the “Format” submenu and its items (plus “Copy as Markdown”) can be localized via JS-provided labels while keeping native code free of fallback strings.
Changes:
- Introduces a shared
normalizeMenuItemhelper (pluswarnOnce) to normalize{ enabled, label }items and support legacy boolean configs with a one-time deprecation warning. - Expands input context-menu config plumbing to carry submenu/action/item labels through codegen → iOS/Android menu construction.
- Updates the example Storybook stories to demonstrate defaults, localized labels, and the deprecated boolean runtime shim.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-enriched-markdown/src/shared/normalizeMenuItem.ts | New shared normalization + deprecation warning utility used by text + input menu config. |
| packages/react-native-enriched-markdown/src/native/EnrichedMarkdownText.tsx | Switches selection menu normalization to shared normalizeMenuItem. |
| packages/react-native-enriched-markdown/src/EnrichedMarkdownTextInputNativeComponent.ts | Extends internal config structs with *Label fields for native consumption. |
| packages/react-native-enriched-markdown/src/EnrichedMarkdownTextInput.tsx | Normalizes input menu config to always provide concrete labels + supports legacy booleans at runtime. |
| packages/react-native-enriched-markdown/ios/input/EnrichedMarkdownTextInput+Internal.h | Adds label pointers to config structs for iOS/macOS menus. |
| packages/react-native-enriched-markdown/ios/input/EnrichedMarkdownTextInput+ContextMenu.mm | Uses config-provided labels for iOS/macOS menu titles and items. |
| packages/react-native-enriched-markdown/ios/input/EnrichedMarkdownTextInput.mm | Stores strong owners for label strings and threads them into config structs. |
| packages/react-native-enriched-markdown/android/src/main/java/com/swmansion/enriched/markdown/input/toolbar/InputContextMenu.kt | Uses config-provided labels for Android submenu title, items, and “Copy as Markdown”. |
| packages/react-native-enriched-markdown/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt | Parses label fields from the RN prop map into Kotlin config data classes. |
| apps/react-native-example/.rnstorybook/stories/components/EnrichedMarkdownTextInput/props/FormatMenu.stories.tsx | Adds stories covering localized labels, English defaults, and deprecated boolean form. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hryhoriiK97
reviewed
Jun 29, 2026
hryhoriiK97
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! I've left one comment — please take a look at it.
hryhoriiK97
approved these changes
Jun 29, 2026
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.
What/Why?
Extends PR #415 localizable-labels pattern from
EnrichedMarkdownTextto the input context menu introduced in PR #409. Apps that localize the renderer's selectionMenuConfig would otherwise still see an English "Format / Bold / Italic / … / Copy as Markdown" submenu onEnrichedMarkdownTextInput- this closes that gap.Nine new label slots, all opt-in and additive to existing config:
formatMenuConfig.{bold,italic,underline,strikethrough,spoiler,link}- each now takes{ enabled?, label? }instead ofboolean.inputSelectionMenuConfig.formatand.copyAsMarkdown- same shape; format.label controls the submenu title itself.The legacy boolean form keeps working at runtime and logs a one-time warnOnce deprecation; removed in 0.8. Same shape evolution as PR #415.
JS resolves the English defaults so native code carries no fallback strings - Android / iOS / macOS just read labels straight from the config struct or data class, matching the convention from #415.
Refactor:
normalizeMenuItem+warnOnceextracted fromsrc/native/EnrichedMarkdownText.tsxintosrc/shared/normalizeMenuItem.tsso bothselectionMenuConfig(text) andformatMenuConfig / inputSelectionMenuConfig(input) share deprecation rules and fallback semantics.Not in scope (intentional):
NSTextAttachmentimages; would require attachingUIContextMenuInteractionto image regions. TODO already noted inios/utils/EditMenuUtils.h.Platforms: iOS, Android, macOS
Testing
apps/react-native-example/.rnstorybook/stories/components/EnrichedMarkdownTextInput/props/FormatMenu.stories.tsxextended with three stories mirroring the SelectionMenu story layout:formatMenuConfig/inputSelectionMenuConfig; verifies the JS-side fallback path resolves to the built-in English labels across all three platforms.bold: false/copyAsMarkdown: false; verifies the warnOnce deprecation fires once and visibility still toggles correctly through the compat shim.Screenshots
Screen.Recording.2026-06-25.at.14.32.47.mov
Screen.Recording.2026-06-25.at.14.34.34.mov
PR Checklist
Adresses #407