react-multi-email icon indicating copy to clipboard operation
react-multi-email copied to clipboard

override onKeyDown

Open edentsubery opened this issue 3 years ago • 5 comments

hello, I am new to react and am trying to override the handleOnKeydown function to work better with the rest on my components. I am unable to figure out how to do so. I am adding a copy of my code, please tell me if there is a way to override it

<ReactMultiEmail

                                             placeholder="Enter Email addresses of study buddies"
                                             emails={emails}

                                             onKeyDown={onKeyDown}
                                             autoFocus={true}
                                             onChange={(_emails: string[]) => {
                                                 this.setState({ emails: _emails });
                                             }}
                                             validateEmail={email => {
                                                 return isEmail(email); // return boolean
                                             }}
                                             getLabel={(
                                                 email: string,
                                                 index: number,
                                                 removeEmail: (index: number) => void,
                                             ) => {
                                                 return (
                                                     <div data-tag key={index}>
                                                         {email}
                                                         <span data-tag-handle onClick={
                                                             () => {removeEmail(index)
                                                                 this.onDelete(email)}
                                                         }>×</span>

                                                     </div>
                                                 );
                                             }}

                            />

edentsubery avatar Nov 30 '22 09:11 edentsubery

If you want to use onkeydown, I will add the code and upgrade the version, please try once the version is distributed.

thomasJang avatar Nov 30 '22 09:11 thomasJang

You can use v1.0.3

thomasJang avatar Nov 30 '22 09:11 thomasJang

thank you so much! I really appreciate the quick response :)

edentsubery avatar Nov 30 '22 09:11 edentsubery

@thomasJang can i disable comma key?

jagdishjnext avatar Dec 19 '22 11:12 jagdishjnext

i want to not add value when i entered comma key is it possible?

jagdishjnext avatar Dec 19 '22 11:12 jagdishjnext