Skip to content

Commit 3f5f2aa

Browse files
exploIFszydlovsky
andauthored
chore: readme improvements (#167)
Co-authored-by: szydlovsky <[email protected]>
1 parent 580a87a commit 3f5f2aa

File tree

1 file changed

+43
-40
lines changed

1 file changed

+43
-40
lines changed

README.md

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Built by [Software Mansion](https://swmansion.com/) and sponsored by [Filament](
2222
<img width="80" height="80" alt="Filament Logo" src="https://github.com/user-attachments/assets/4103ab79-da34-4164-aa5f-dcf08815bf65" />
2323

2424
\
25-
Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues.
25+
Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues.
2626
We can help you build your next dream product –
2727
[Hire us](https://swmansion.com/contact/projects?utm_source=react-native-enriched&utm_medium=readme).
2828

@@ -139,27 +139,27 @@ const styles = StyleSheet.create({
139139
Summary of what happens here:
140140

141141
1. Any methods imperatively called on the input to e.g. toggle some style must be used through a `ref` of `EnrichedTextInputInstance` type. Here, `toggleBold` method that is called on the button press calls `ref.current?.toggleBold()`, which toggles the bold styling within the current selection.
142-
2. All the active styles info is emitted by `onChangeState` event. Set up a proper callback that accepts a `NativeSyntheticEvent<OnChangeStateEvent>` argument and you can access an object with boolean properties indicating which styles are active, such as `isBold` in the example. Here, this info is stored in a react state and used to change colors on the button.
142+
2. All the active styles info is emitted by `onChangeState` event. Set up a proper callback that accepts a `NativeSyntheticEvent<OnChangeStateEvent>` argument, and you can access an object with boolean properties indicating which styles are active, such as `isBold` in the example. Here, this info is stored in a React state and used to change colors on the button.
143143

144144
## Non Parametrized Styles
145145

146146
Supported styles:
147147

148-
- **bold**
149-
- *italic*
150-
- <ins>underline</ins>
151-
- ~~strikethrough~~
152-
- `inline code`
148+
- bold
149+
- italic
150+
- underline
151+
- strikethrough
152+
- inline code
153153
- H1 heading
154154
- H2 heading
155155
- H3 heading
156-
- `codeblock`
157-
- > blockquote
156+
- codeblock
157+
- blockquote
158158
- ordered list
159159
- unordered list
160160

161161
> [!NOTE]
162-
> The iOS doesn't support codeblocks just yet but it's planned in the near future!
162+
> The iOS doesn't support codeblocks just yet, but it's planned in the near future!
163163
164164
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.
165165

@@ -176,7 +176,7 @@ The links are here, just like in any other editor, a piece of text with a URL at
176176

177177
### Automatic links detection
178178

179-
`react-native-enriched` automatically detects words that appear to be some URLs and makes them links. Currently we are using pretty naive approach to detect whether text can be treated as a link or not. On iOS it's a pretty simple regex, on Android we are using URL regex provided by the system.
179+
`react-native-enriched` automatically detects words that appear to be some URLs and makes them links. Currently, we are using pretty naive approach to detect whether text can be treated as a link or not. On iOS it's a pretty simple regex, on Android we are using URL regex provided by the system.
180180

181181
### Applying links manually
182182

@@ -194,7 +194,7 @@ Mentions are meant to be a customisable style that lets you put mentioning phras
194194

195195
### Mention Indicators
196196

197-
There is a [mentionIndicators](#mentionindicators) prop that lets you define what characters can start a mention. By default it is set to `[ @ ]`, meaning that typing a `@` character in the input will start the creation of a mention.
197+
There is a [mentionIndicators](#mentionindicators) prop that lets you define what characters can start a mention. By default, it is set to `[ @ ]`, meaning that typing a `@` character in the input will start the creation of a mention.
198198

199199
### Starting a mention
200200

@@ -216,10 +216,10 @@ Whenever you feel ready with the currently edited mention (so most likely user c
216216

217217
You can insert an image into the input using [setImage](#setimage) ref method.
218218

219-
The image will be put into a single line in the input and will affects 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.
219+
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.
220220

221221
> [!NOTE]
222-
> The iOS doesn't support inline images just yet but it's planned in the near future!
222+
> The iOS doesn't support inline images just yet, but it's planned in the near future!
223223
224224
## Style Detection
225225

@@ -294,7 +294,7 @@ If `false`, text is not editable.
294294

295295
#### `htmlStyle`
296296

297-
A prop for customizing styles' appearances.
297+
A prop for customizing styles appearances.
298298

299299
| Type | Default Value | Platform |
300300
|--------------------------------|----------------------------------------------------|----------|
@@ -330,9 +330,9 @@ interface OnChangeHtmlEvent {
330330

331331
- `value` is the new HTML.
332332

333-
| Type | Default Value | Platform |
334-
|------------------------------------------------------|---------------|----------|
335-
| `(NativeSyntheticEvent\<OnChangeHtmlEvent>) => void` | - | Both |
333+
| Type | Default Value | Platform |
334+
|------------------------------------------------------------|---------------|----------|
335+
| `(event: NativeSyntheticEvent<OnChangeHtmlEvent>) => void` | - | Both |
336336

337337
#### `onChangeMention`
338338

@@ -350,9 +350,9 @@ interface OnChangeMentionEvent {
350350
- `indicator` is the indicator of the currently edited mention.
351351
- `text` contains whole text that has been typed after the indicator.
352352

353-
| Type | Default Value | Platform |
354-
|----------------------------------|---------------|----------|
355-
| `(OnChangeMentionEvent) => void` | - | Both |
353+
| Type | Default Value | Platform |
354+
|-----------------------------------------|---------------|----------|
355+
| `(event: OnChangeMentionEvent) => void` | - | Both |
356356

357357
#### `onChangeSelection`
358358

@@ -361,7 +361,7 @@ Callback that is called each time user changes selection or moves the cursor in
361361
Payload interface:
362362

363363
```ts
364-
OnChangeSelectionEvent {
364+
interface OnChangeSelectionEvent {
365365
start: Int32;
366366
end: Int32;
367367
text: string;
@@ -372,9 +372,9 @@ OnChangeSelectionEvent {
372372
- `end` is the first index after the selection's ending. For just a cursor in place (no selection), `start` equals `end`.
373373
- `text` is the input's text in the current selection.
374374

375-
| Type | Default Value | Platform |
376-
|-----------------------------------------------------------|---------------|----------|
377-
| `(NativeSyntheticEvent\<OnChangeSelectionEvent>) => void` | - | Both |
375+
| Type | Default Value | Platform |
376+
|-----------------------------------------------------------------|---------------|----------|
377+
| `(event: NativeSyntheticEvent<OnChangeSelectionEvent>) => void` | - | Both |
378378

379379
#### `onChangeState`
380380

@@ -402,9 +402,9 @@ interface OnChangeStateEvent {
402402
}
403403
```
404404

405-
| Type | Default Value | Platform |
406-
|-------------------------------------------------------|---------------|----------|
407-
| `(NativeSyntheticEvent\<OnChangeStateEvent>) => void` | - | Both |
405+
| Type | Default Value | Platform |
406+
|-------------------------------------------------------------|---------------|----------|
407+
| `(event: NativeSyntheticEvent<OnChangeStateEvent>) => void` | - | Both |
408408

409409
#### `onChangeText`
410410

@@ -420,9 +420,9 @@ interface OnChangeTextEvent {
420420

421421
- `value` is the new text value of the input.
422422

423-
| Type | Default Value | Platform |
424-
|------------------------------------------------------|---------------|----------|
425-
| `(NativeSyntheticEvent\<OnChangeTextEvent>) => void` | - | Both |
423+
| Type | Default Value | Platform |
424+
|------------------------------------------------------------|---------------|----------|
425+
| `(event: NativeSyntheticEvent<OnChangeTextEvent>) => void` | - | Both |
426426

427427
#### `onEndMention`
428428

@@ -462,9 +462,9 @@ interface OnLinkDetected {
462462
- `start` is the starting index of the link.
463463
- `end` is the first index after the ending index of the link.
464464

465-
| Type | Default Value | Platform |
466-
|----------------------------|---------------|----------|
467-
| `(OnLinkDetected) => void` | - | Both |
465+
| Type | Default Value | Platform |
466+
|-----------------------------------|---------------|----------|
467+
| `(event: OnLinkDetected) => void` | - | Both |
468468

469469
#### `onMentionDetected`
470470

@@ -473,7 +473,7 @@ Callback called when mention has been detected - either a new mention has been a
473473
Payload interface contains all the useful mention data:
474474

475475
```ts
476-
OnMentionDetected {
476+
interface OnMentionDetected {
477477
text: string;
478478
indicator: string;
479479
attributes: Record<string, string>;
@@ -484,9 +484,9 @@ OnMentionDetected {
484484
- `indicator` is the indicator of the mention.
485485
- `attributes` are the additional user-defined attributes that are being stored with the mention.
486486

487-
| Type | Default Value | Platform |
488-
|-------------------------------|---------------|----------|
489-
| `(OnMentionDetected) => void` | - | Both |
487+
| Type | Default Value | Platform |
488+
|--------------------------------------|---------------|----------|
489+
| `(event: OnMentionDetected) => void` | - | Both |
490490

491491
#### `onStartMention`
492492

@@ -560,12 +560,12 @@ If true, Android will use experimental synchronous events. This will prevent fro
560560

561561
### Ref Methods
562562

563-
All of the methods should be called on the input's [ref](#ref).
563+
All the methods should be called on the input's [ref](#ref).
564564

565565
#### `.blur()`
566566

567567
```ts
568-
blur: () => void
568+
blur: () => void;
569569
```
570570

571571
Blurs the input.
@@ -812,6 +812,9 @@ interface MentionStyleProperties {
812812
- `fontSize` is the size of the heading's font, defaults to `32`/`24`/`20` for h1/h2/h3.
813813
- `bold` defines whether the heading should be bolded, defaults to `false`.
814814

815+
> [!NOTE]
816+
> On iOS, the headings cannot have same `fontSize` as the component's `fontSize`. Doing so results in unexpected behavior.
817+
815818
#### blockquote
816819

817820
- `borderColor` defines the color of the rectangular border drawn to the left of blockquote text. Takes [color](https://reactnative.dev/docs/colors) value, defaults to `darkgray`.

0 commit comments

Comments
 (0)