Closed gdaniel closed 4 years ago
@hamzaed I used a setTimeout
call in Sender/index.js
to make sure the selection was correctly updated after changing the value when the ArrowUp
key is pressed (i.e. the cursor is correctly displayed after the last character of the input). Without the setTimeout
the cursor is displayed at the beginning of the input, and moves back to its proper location after typing 1 character.
This looks like a ugly hack but I couldn't find something else to make it work. If you have an idea let me know
@gdaniel The problem was that you were mapping arrowUp
key which has the default action of moving the cursor to the beginning of the input text.
The solution is to add e.preventDefault();
to onKeyDown
. With that, no need to add anything to componentDidUpdate
.
I refactored the code and now it's even possible to get all old messages.
And reuse it with up arrow.
Reported by @jlcanovas