Skip to content

Conversation

@patrickkabwe
Copy link
Owner

@patrickkabwe patrickkabwe commented Nov 23, 2025

This PR adds Android support for NitroText with custom menu implementation and HTML rendering logic.

- add Android Nitro module with Kotlin view, Fabric state updater, and JNI bridge

- share component descriptor/state logic so Fabric can hydrate props on Android

- update TypeScript entrypoint, codegen pipeline, and example app for Android support
* feat(android): add NitroText HybridView implementation

- add Android Nitro module with Kotlin view, Fabric state updater, and JNI bridge

- share component descriptor/state logic so Fabric can hydrate props on Android

- update TypeScript entrypoint, codegen pipeline, and example app for Android support

* feat: add support for `onTextLayout`

* feat: implement fragment background color support in NitroText
- Add Android native implementation for NitroText
- Implement custom menu support with MenuItem type
- Add menus prop to NitroText component
- Update Android build configuration
- Add MenuItem bridge code for Android
- Update component descriptors and specs for menu support
- Remove old renderer system (NitroRenderer, RichTextStyle, RichTextStyleRule)
- Add new Renderer type for HTML and plaintext rendering
- Update renderer prop support in native implementations
- HTML parsing is now handled in JS/TS layer
- Add renderer bridge code for Android
- Remove BulletListSpan, NumberedListSpan, VerticalMarginSpan, LetterSpacingSpan
- Remove duplicate NitroLineHeightSpan from parent directory
- Keep only NitroLineHeightSpan and UrlSpanNoUnderline which are actively used
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +39 to +43
HybridObjectRegistry::registerHybridObjectConstructor(
"NitroText",
[]() -> std::shared_ptr<HybridObject> {
static DefaultConstructableObject<JHybridNitroTextSpec::javaobject> object("com/margelo/nitro/nitrotext/HybridNitroText");
auto instance = object.create();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix Android HybridNitroText registration package

The Android JNI bootstrap still registers NitroText using the generated class path com/margelo/nitro/nitrotext/HybridNitroText, but the actual Kotlin implementation lives in com.nitrotext (see android/src/main/java/com/nitrotext/HybridNitroText.kt). At runtime the HybridObjectRegistry will attempt to construct a class that does not exist, so the Android view cannot be created unless a manual post-processing script rewrites this string. The registration should point at the real package.

Useful? React with 👍 / 👎.

- Updated the default link color assignment in NitroTextImpl to maintain consistency with the intended design, ensuring that the system link color is applied correctly when no explicit color is provided.
- Modify UrlSpanNoUnderline to not apply default link color
- Apply color span after URLSpan to ensure custom colors take precedence
- Support both custom link colors and default blue when no color specified
…tion

- Implemented a layout change listener in NitroTextView to ensure proper height adjustment for content expansion.
- Renamed createCustomActionModeCallback to configureActionModeCallback for clarity in action mode handling.
- Updated NitroText interface to use consistent object notation for platform specifications.
@patrickkabwe patrickkabwe mentioned this pull request Nov 25, 2025
2 tasks
…support

- Added support for text alignment in NitroTextImpl, allowing fragments to specify alignment (left, right, center, justify).
- Updated applyDecorationSpans to accept a decoration color parameter, enabling custom colors for text decorations.
- Modified example screens to demonstrate new text alignment and decoration features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants