File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ interface EnrichedTextProps extends ViewProps {
3939 allowFontScaling? : boolean ;
4040 onLinkPress? : (event : OnLinkPressEvent ) => void ;
4141 onMentionPress? : (event : OnMentionPressEvent ) => void ;
42+ onImagePress? : (event : OnImagePressEvent ) => void ;
4243}
4344```
4445
@@ -209,6 +210,33 @@ interface OnMentionPressEvent {
209210| -------------------------------------- | ----------------- |
210211| ` (event: OnMentionPressEvent) => void ` | Android, iOS, Web |
211212
213+ ### ` onImagePress ` {#onimagepress}
214+
215+ Called when the user presses an inline image. Receives an ` OnImagePressEvent `
216+ with the image's URI and dimensions. See
217+ [ Inline images] ( /rich-text-formatting/inline-images ) for how images are
218+ inserted and rendered.
219+
220+ ``` ts
221+ interface OnImagePressEvent {
222+ image: {
223+ uri: string ;
224+ width: number ;
225+ height: number ;
226+ };
227+ }
228+ ```
229+
230+ | Type | Platforms |
231+ | ------------------------------------ | ----------------- |
232+ | ` (event: OnImagePressEvent) => void ` | Android, iOS, Web |
233+
234+ ::: note
235+
236+ No visual feedback is applied on press.
237+
238+ :::
239+
212240## EnrichedTextHtmlStyle type
213241
214242Extends [ ` HtmlStyle ` ] ( /api-reference/enriched-text-input#htmlstyle-type ) with
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Full payload shapes of the available callbacks can be found in the [`EnrichedTex
1414
1515This page covers ` EnrichedTextInput ` events. The read-only
1616[ ` EnrichedText ` ] ( /core-functionalities/rendering-rich-text ) component only
17- exposes ` onLinkPress ` and ` onMentionPress ` callbacks.
17+ exposes ` onLinkPress ` , ` onMentionPress ` , and ` onImagePress ` callbacks.
1818
1919:::
2020
Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ the only shape difference from the input's `htmlStyle`. See the
5353
5454- ** ` selectable ` ** - allow the user to select and copy the rendered text.
5555 Defaults to ` false ` .
56- - ** ` onLinkPress ` / ` onMentionPress ` ** - fire when a link or mention is pressed.
56+ - ** ` onLinkPress ` / ` onMentionPress ` / ` onImagePress ` ** - fire when a link,
57+ mention, or inline image is pressed.
5758- ** ` numberOfLines ` / ` ellipsizeMode ` ** - truncate long content to a fixed
5859 number of lines with an ellipsis.
5960- ** ` useHtmlNormalizer ` ** - normalize external or messy HTML into the library's canonical
Original file line number Diff line number Diff line change @@ -59,3 +59,10 @@ surfaces those through the [`onPasteImages`](/api-reference/enriched-text-input#
5959MIME type, and dimensions so you can upload or resize before inserting.
6060
6161:::
62+
63+ ## Handling image presses
64+
65+ When rendering content with [ ` EnrichedText ` ] ( /core-functionalities/rendering-rich-text ) ,
66+ use [ ** ` onImagePress ` ** ] ( /api-reference/enriched-text#onimagepress ) to react when
67+ the user taps an inline image. The callback receives the image's URI and
68+ dimensions. No visual feedback is applied on press.
You can’t perform that action at this time.
0 commit comments