Skip to content

Commit d27c2c1

Browse files
duom青源duom青源
authored andcommitted
feat: update README.md
1 parent 8d4d152 commit d27c2c1

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
# react-native-variable-text-input
22

3-
my variable textInput
3+
custom emoji textInput mentions which works both ios and Android
4+
5+
## Demonstration
6+
7+
<img src="./gifs/demo.gif?raw=true" width="60%">
8+
9+
## Key features
10+
11+
-Support for customized emoji
12+
-Support for inserting tags (@ && #)
413

514
## Installation
615

16+
Install `react-native-variable-text-input` package from npm:
17+
718
```sh
819
yarn add react-native-variable-text-input
9-
```
10-
```ios
20+
# or
21+
# npm install react-native-variable-text-input --save
1122
cd ios
1223
pod install
13-
## Usage
14-
15-
```js
16-
import { VariableTextInputView } from "react-native-variable-text-input";
24+
```
1725

18-
// ...
26+
## Documentation
1927

20-
<VariableTextInputView style = {{flex:1,height:20,width:'100%'}}/>
21-
```
28+
//todo
2229

2330
## Contributing
2431

example/src/App.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ import VariableTextInputView, {
1616
export const App = () => {
1717
const inPutRef = React.createRef<IATTextViewBase>();
1818
const onChangeText = (text: string) => {
19+
console.log('输入框数据====>', text);
1920
const triggerRegEx = /({([^{^}]*)}\[([^[]*)]\(([^(^)]*)\))/gi;
2021
const singleGroupTriggerRegEx = /({[^{^}]*}\[[^[]*]\([^(^)]*\))/gi;
2122
const matchStr = text.match(triggerRegEx);
2223
if (matchStr !== null) {
2324
const subStrArr = text.split(triggerRegEx);
2425
subStrArr.forEach((item) => {
2526
const arr = item.match(singleGroupTriggerRegEx);
26-
console.log('====>', arr);
27+
console.log('==处理后的数据==>', arr);
2728
});
2829
}
2930
};
@@ -42,9 +43,9 @@ export const App = () => {
4243
};
4344
const insertMonthons = () => {
4445
inPutRef.current?.insertMentions({
45-
tag: '#',
46-
name: '测试tag',
47-
color: 'red',
46+
tag: '@',
47+
name: 'James Harden',
48+
color: '#CEDA39',
4849
id: '123344',
4950
type: ITextType.tagText,
5051
});
@@ -57,14 +58,24 @@ export const App = () => {
5758
const tagData: IInserTextAttachmentItem = {
5859
tag: '#',
5960
name: '测试tag',
60-
color: 'red',
61+
color: '#CEDA39',
6162
id: '123344',
6263
type: ITextType.tagText,
6364
};
6465
inPutRef.current?.changeAttributedText([
6566
{ type: 0, text: '普通字符' },
6667
{ type: 1, ...emojiData },
6768
tagData,
69+
{ type: 0, text: '普通字符' },
70+
tagData,
71+
{ type: 1, ...emojiData },
72+
{ type: 0, text: '普通字符' },
73+
tagData,
74+
{ type: 0, text: '普通字符' },
75+
tagData,
76+
{ type: 1, ...emojiData },
77+
{ type: 1, ...emojiData },
78+
{ type: 1, ...emojiData },
6879
]);
6980
};
7081
const focus = () => {
@@ -120,7 +131,7 @@ const styles = StyleSheet.create({
120131
justifyContent: 'center',
121132
},
122133
box: {
123-
backgroundColor: 'blue',
134+
backgroundColor: '#000',
124135
color: '#fff',
125136
fontSize: 14,
126137
width: '100%',

gifs/demo.gif

298 KB
Loading

0 commit comments

Comments
 (0)