FaridSafi / react-native-gifted-chat

💬 The most complete chat UI for React Native
https://gifted.chat
MIT License
13.56k stars 3.55k forks source link

Input gets cleared on keyboard dismiss #2523

Open steavenb opened 2 months ago

steavenb commented 2 months ago

Input gets cleared on keyboard dismiss

While typing a message, if we click on the messages section and dismiss the keyboard, the input message is cleared

Expected Results

It should not clear, or there should be a prop that controls it.

ImBeCiliC commented 2 months ago

This is due to a PR that added a reset of the text. This also happens when you switch to emoji keyboard.

This is the part that adds the issue: https://github.com/FaridSafi/react-native-gifted-chat/pull/2493/files#diff-b11e3f8b30e19689a33f545b3567228eb41fd9cfbbad474b1b21e7b63eaa2d57R542-R545

@steavenb we fixed it with a custom composer and adding the prop text as null renderComposer={(composerProps: ComposerProps) => <ChatComposer {...composerProps} text={null} />}

Edit: Above fix introduced multiple issues caused by setting text to null manually therefore we created a patch for this issue and open a PR for this fix. https://github.com/FaridSafi/react-native-gifted-chat/pull/2541

jorgtz commented 3 weeks ago

Hello, is this going to be merged? It is an important bug!