Skip to content

Commit

Permalink
issue/8 initial value set back to onChangeHandler. Updated version.
Browse files Browse the repository at this point in the history
  • Loading branch information
raza committed Nov 20, 2019
1 parent d170697 commit d09d690
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions example/ChatScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ChatScreen extends Component {
initialValue:
"Hey @[mrazadar](id:1) this is good work. Tell @[john.doe](id:5) to use this package.",
showEditor: true,
message: "",
message: null,
messages: [],
clearInput: false,
showMentions: false /**use this parameter to programmatically trigger the mentionsList */
Expand All @@ -46,6 +46,7 @@ class ChatScreen extends Component {
/**
* this callback will be called whenever input value change and will have
* formatted value for mentioned syntax
* @message : {text: 'Hey @(mrazadar)(id:1) this is good work.', displayText: `Hey @mrazadar this is good work`}
* */

this.setState({
Expand All @@ -54,12 +55,11 @@ class ChatScreen extends Component {
});
};
sendMessage = () => {
if (this.state.message == "") return;
if (!this.state.message) return;
const messages = [this.state.message, ...this.state.messages];
console.log("Messages", messages);
this.setState({
messages,
message: "",
message: null,
clearInput: true
});
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-mentions-editor",
"version": "1.0.10",
"version": "1.0.11",
"description": "Mentions for React-Native. Tested on iOS. Should work on Andriod.",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export class Editor extends React.Component {
this.mentionsMap = map;
msg = newValue;
formattedMsg = this.formatText(newValue);
setTimeout(()=>{
this.sendMessageToFooter(newValue);
});
}
this.state = {
clearInput: props.clearInput,
Expand Down

0 comments on commit d09d690

Please sign in to comment.