Skip to content

feat: add onImagePress event to EnrichedText#681

Open
kacperzolkiewski wants to merge 5 commits into
mainfrom
@kacperzolkiewski/feat-on-image-press
Open

feat: add onImagePress event to EnrichedText#681
kacperzolkiewski wants to merge 5 commits into
mainfrom
@kacperzolkiewski/feat-on-image-press

Conversation

@kacperzolkiewski

@kacperzolkiewski kacperzolkiewski commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add OnImagePress event

Test Plan

  1. Display remote and local images inside EnrichedText in example app.
  2. Press on them and check if OnImagePress event is emitted

Screenshots / Videos

Screen.Recording.2026-07-06.at.17.13.49.mov

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

@kacperzolkiewski kacperzolkiewski marked this pull request as ready for review July 6, 2026 19:14
Copilot AI review requested due to automatic review settings July 6, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new cross-platform (iOS/Android) onImagePress event to EnrichedText, allowing consumers to react to presses on inline <img> elements and receive the pressed image’s URI and dimensions.

Changes:

  • Extend the public TS API (EnrichedTextProps) with onImagePress and a new OnImagePressEvent type, and re-export it from the package entrypoints.
  • Wire the event through the React Native codegen spec and JS wrapper, then emit it from native iOS + Android implementations.
  • Document the new prop, update the example app to demonstrate it, and add an E2E Maestro flow covering image press.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/types.ts Adds onImagePress prop and OnImagePressEvent type to the public TS API.
src/spec/EnrichedTextNativeComponent.ts Adds codegen event type + onImagePress to native component props.
src/native/EnrichedText.tsx Plumbs the native onImagePress event through to the JS EnrichedText prop.
src/index.tsx Re-exports OnImagePressEvent from the library entrypoint.
src/index.native.tsx Re-exports OnImagePressEvent for native entrypoint parity.
ios/utils/EnrichedTextTouchHandler.mm Detects presses on EnrichedImage attributes and dispatches image-press events.
ios/EnrichedTextView.mm Emits onImagePress via the Fabric event emitter with URI + dimensions.
ios/EnrichedTextView.h Declares emitOnImagePressEvent: on the view interface.
docs/TEXT_API_REFERENCE.md Documents onImagePress, its payload shape, and lack of visual feedback.
apps/example/src/screens/EnrichedTextScreen.tsx Demonstrates handling onImagePress in the example screen.
apps/example/src/components/TextRenderer.tsx Demonstrates handling onImagePress in the renderer component.
android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextImageSpan.kt Makes image spans clickable and dispatches OnImagePressEvent.
android/src/main/java/com/swmansion/enriched/text/events/OnImagePressEvent.kt Adds the native Android event payload for onImagePress.
android/src/main/java/com/swmansion/enriched/text/EnrichedTextViewManager.kt Registers onImagePress as a direct event for the view manager.
.maestro/enrichedText/flows/image_press.yaml Adds an E2E flow to validate image press event behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kacperzolkiewski kacperzolkiewski marked this pull request as draft July 7, 2026 08:41
@kacperzolkiewski kacperzolkiewski marked this pull request as ready for review July 10, 2026 10:14
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