3

I have a modal in my screen, which has an input box. What i want is when user presses "return" or "done" button in ios keypad , i want my input to go an redux action, so what i am doing is

Refer here to see ios keypad

<input
      type="text"
      placeholder="Type a message"
      onChange={e => setMessage(e)}
      onKeyDown={e => keyDown(e)}
      value={inputText}
                />

then

const keyDown = e => {
    if (e.keyCode == 13) {
      dispatch(userResponseChat(inputText));
      setInputText("");
    }
  };

so for now it works well on android keypad and ios keypad when we press "return" button, but is there any way i could trigger the same when user click on "done" button in reactjs?

Ratnabh kumar rai
  • 1,426
  • 4
  • 21
  • 48
  • [Many many attempts](https://www.google.com/search?q=javascript+detect+ios+done+keyboard+site:stackoverflow.com) - consensus seems to listen for focusout – mplungjan Apr 07 '21 at 05:07
  • 1
    @mplungjan sorry the link doesnt work :\ – Ratnabh kumar rai Apr 07 '21 at 06:18
  • Which link. I posted [many links](https://www.google.com/search?q=javascript+detect+ios+done+keyboard+site:stackoverflow.com) - and if they do not work, then it is likely impossible – mplungjan Apr 07 '21 at 06:25
  • @mplungjan those didnt worked out,tried with onblur too , but my case is little different, the focus has to be on input field cause its like a chat ui. Please help :( – Ratnabh kumar rai Apr 07 '21 at 09:29
  • Little different how? I reopened the question – mplungjan Apr 07 '21 at 11:17

0 Answers0