The quickstart on readme.md mentioned this.handleSubmit = this.handleSubmit.bind(this);
, which is empty and will set off error.
Moreover, onChange
is handled properly while onSubmit
is not.
Maybe we need to handle ENTER
?
if(s === ENTER && this.props.onSubmit && value !== originalValue){
return this.props.onSubmit(value);
}
I was just about to open an issue for this. Would be awesome! (And I see the deprecated password input component has onSubmit
)
3rded - for now I've copied the code into a file locally and added my own onSubmit
method
4thed - I added my own custom onSubmit too.
@danrspencer @jcar787 let's do a pull request, what do you say? :D
@entrptaher I think you should do it since you discovered the issue first and added the gist. 😊
Thanks for the gist though.
You are right.
However, I dug deep into it and found I had problem with cursorOffset when I submit using ENTER.
Then I asked on this issue :D
Hook version. You don't get the value from it though.
I guess I accidentally removed it when migrating to Ink 2 or earlier 🤷♂️ If anyone's willing to help out with this, would be great! If not, I will take care of it bit later this week.
@SimenB let me test the cursorOffset, I am really curious about it. :D
This works flawlessly.
The issue can be closed.
Many thanks everyone.
Gonna go find next bug :D
Most helpful comment
3rded - for now I've copied the code into a file locally and added my own
onSubmit
method