1
- React Native Controlled Mentions
1
+ react-native-controlled-mentions ![ ] ( https://img.shields.io/npm/v/react-native-controlled-mentions )
2
2
-
3
-
4
- ### About
5
-
6
3
Pretty simple and fully controlled mentions input. It can:
7
4
8
5
* Gracefully render formatted mentions directly in RN ` TextInput ` component
9
6
* Use ` value ` /` onChange ` as in usual ` TextInput ` props
10
7
* Completely typed (written on TypeScript)
11
8
* No need native libraries
12
9
13
- ### Getting started
10
+ Demo
11
+ -
12
+ Try it on Expo Snack: https://snack.expo.io/@dabakovich/mentionsapp
13
+
14
+ ![ ] ( demo.gif )
15
+
16
+ Getting started
17
+ -
14
18
15
19
Install the library using either Yarn:
16
20
@@ -20,9 +24,8 @@ or npm:
20
24
21
25
`` npm install --save react-native-controlled-mentions ``
22
26
23
- ### Example
24
-
25
- Try it on Expo Snack: https://snack.expo.io/@dabakovich/mentionsapp
27
+ Example
28
+ -
26
29
27
30
``` tsx
28
31
import * as React from ' react' ;
@@ -94,7 +97,8 @@ const App = () => {
94
97
export default App ;
95
98
```
96
99
97
- ### Configuration
100
+ Configuration
101
+ -
98
102
99
103
The ` Mentions ` component supports next props:
100
104
@@ -109,7 +113,8 @@ The `Mentions` component supports next props:
109
113
| containerStyle | StyleProp\< ViewStyle> | false | | |
110
114
| ...textInputProps | TextInputProps | false | | Other text input props |
111
115
112
- ### Parsing ` Mention ` 's value
116
+ Parsing ` Mention ` 's value
117
+ -
113
118
114
119
You can import RegEx that is using in the component and then extract all your mentions
115
120
from ` Mention ` 's value using your own logic.
@@ -130,12 +135,14 @@ console.log(replaceMentionValues(value, ({id}) => `@${id}`)); // Hello @5! How a
130
135
console .log (replaceMentionValues (value , ({name }) => ` @${name } ` )); // Hello @David Tabaka! How are you?
131
136
```
132
137
133
- ### To Do
138
+ To Do
139
+ -
134
140
135
141
* Add more customizations
136
142
* Add ability to handle few mention types ("#", "@" etc)
137
143
138
- ### Known issues
144
+ Known issues
145
+ -
139
146
140
147
* Mention name regex accepts white spaces (eg ` {name: ' ', value: 1} ` )
141
148
* ~~ Keyboard auto-correction not working if suggested word has the same length~~ FIXED
0 commit comments