You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some apps might want to use this component to allow users to enter multi-line text. Right now this is not easily achieved as enter is hard-coded to be the "submission key".
My question/proposal would be to add an optional prop that would define what is a submission. Something like the following:
exporttypeProps={// .../** * Function that determines if a key press constitutes a submission (which will result in `onSubmit` being called) */readonlyisSubmit?: (key: Key)=>boolean;// ...};functionTextInput({value: originalValue,
placeholder ='',
focus =true,
mask,
highlightPastedText =false,
showCursor =true,
onChange,
isSubmit =key=>key.return,
onSubmit
}: Props){// ...useInput((input,key)=>{// ...if(isSubmit(key)&&onSubmit){onSubmit(originalValue);return;}// ...);// ...};
This would allow for apps to support multiple-line input, defining what they consider to be the submission (e.g. 3 new lines in a row), all the while being backwards compatible.
Please let me know your thoughts and I can open a PR with the changes.
The text was updated successfully, but these errors were encountered:
Some apps might want to use this component to allow users to enter multi-line text. Right now this is not easily achieved as
enter
is hard-coded to be the "submission key".My question/proposal would be to add an optional prop that would define what is a submission. Something like the following:
This would allow for apps to support multiple-line input, defining what they consider to be the submission (e.g. 3 new lines in a row), all the while being backwards compatible.
Please let me know your thoughts and I can open a PR with the changes.
The text was updated successfully, but these errors were encountered: