Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://github.com/user-attachments/assets/abc75d3b-495b-4a76-a72f-d87ce3ca1ff9" alt="react-native-enriched by Software Mansion" width="100%">
<img src="https://github.com/user-attachments/assets/b010571e-e4a3-4d92-a409-4f9fe614025d" alt="react-native-enriched by Software Mansion" width="100%">

# react-native-enriched

Expand Down Expand Up @@ -152,9 +152,6 @@ Supported styles:
- ordered list
- unordered list

> [!NOTE]
> The iOS doesn't support codeblocks just yet, but it's planned in the near future!

Each of the styles can be toggled the same way as in the example from [usage section](#usage); call a proper `toggle` function on the component ref.

Each call toggles the style within the current text selection. We can still divide styles into two categories based on how they treat the selection:
Expand Down Expand Up @@ -212,9 +209,6 @@ You can insert an image into the input using [setImage](docs/API_REFERENCE.md#se

The image will be put into a single line in the input and will affect the line's height as well as input's height. Keep in mind, that image will replace currently selected text or insert into the cursor position if there is no text selection.

> [!NOTE]
> The iOS doesn't support inline images just yet, but it's planned in the near future!

## Style Detection

All of the above styles can be detected with the use of [onChangeState](docs/API_REFERENCE.md#onchangestate) event payload.
Expand Down
30 changes: 11 additions & 19 deletions docs/API_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,20 @@ Focuses the input.

### `.setImage()`

> [!NOTE]
> This function is Android only as iOS doesn't support inline images just yet.

```ts
setImage: (src: string) => void;
setImage: (src: string, width: number, height: number) => void;
```

Sets the [inline image](#inline-images) at the current selection.
Sets the [inline image](../README.md#inline-images) at the current selection.

- `src: string` - the absolute path to the image.
- `src: string` - absolute path to a file or remote image address.
- `width: number` - width of the image.
- `height: number` - height of the image.

> [!NOTE]
> It's developer responsibility to provide proper width and height, which may require calculating aspect ratio.
> Also, keep in mind that in case of providing incorrect image source, static placeholder will be displayed.
> We may consider adding automatic image size detection and improved error handling in future releases.

### `.setLink()`

Expand Down Expand Up @@ -418,9 +422,6 @@ Toggles bold formatting at the current selection.

### `.toggleCodeBlock()`

> [!NOTE]
> This function is Android only as iOS doesn't support codeblocks just yet.

```ts
toggleCodeBlock: () => void;
```
Expand Down Expand Up @@ -537,10 +538,6 @@ interface HtmlStyle {
textDecorationLine?: 'underline' | 'none';
};
mention?: Record<string, MentionStyleProperties> | MentionStyleProperties;
img?: {
width?: number;
height?: number;
};
ol?: {
gapWidth?: number;
marginLeft?: number;
Expand Down Expand Up @@ -601,16 +598,11 @@ If only a single config is given, the style applies to all mention types. You ca
- `backgroundColor` is the mention's background color, takes [color](https://reactnative.dev/docs/colors) value and defaults to `yellow`.
- `textDecorationLine` decides if the mentions are underlined or not, takes either `underline` or `none` and defaults to `underline`.

### img (inline image)

- `width` is the width of the inline image, defaults to `80`.
- `height` is the height of the inline image, defaults to `80`.

### ol (ordered list)

By marker we mean the number that denotes next lines of the list.

- `gapWidth` sets the gap between the marker and the list item's text, defaults to `16`.
- `gapWidth` sets the gap between the marker and the list item's text, defaults to `16`.
- `marginLeft` sets the margin to the left of the marker (between the marker and input's left edge), defaults to `16`.
- `markerFontWeight` defines the font weight of the marker, takes a [fontWeight](https://reactnative.dev/docs/text-style-props#fontweight) value and if not set, defaults to the same font weight as input's [fontWeight prop](#style).
- `markerColor` sets the text color of the marker, takes [color](https://reactnative.dev/docs/colors) value and if not set, defaults to the same color as input's [color prop](#style).
Expand Down
Loading