question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onInputTextChanged behavior

See original GitHub issue

Issue Description

I want to cache my textMessage in a Redux store, so I included the text prop in Gifted chat with the value of the textMessage prop in the store, with onInputTextChanged prop on the Gifted Chat, but it clears when it is initially rendered.

Same as Issue #603

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

4reactions
Vi-dotcommented, Sep 17, 2020

A quick hack

import { GiftedChat } from 'react-native-gifted-chat';

GiftedChat.prototype.notifyInputTextReset = () => {};

or better, if you want to keep notifyInputTextReset() working in resetInputToolbar()

GiftedChat.prototype.notifyInputTextReset = function () {
    if (this.props.onInputTextChanged && this.state.isInitialized === true) {
        this.props.onInputTextChanged('')
    }
};
2reactions
alikazemkhanloocommented, Apr 16, 2019

Wouldn’t a new prop be nicer? something like clearTextOnInitialLayout.

Read more comments on GitHub >

github_iconTop Results From Across the Web

InputCallback | Android Developers
Notifies when the user finished entering text in an input box. default void. onInputTextChanged(@NonNull String text). Notifies the current text has changed in ......
Read more >
Developers - onInputTextChanged behavior - - Bountysource
Issue Description. I want to cache my textMessage in a Redux store, so I included the text prop in Gifted chat with the...
Read more >
react native - Issue with Gifted Chat, the messages jump up ...
I'm using Gifted Chat for react native, but I'm getting strange behavior. ... isAnimated scrollToBottom onInputTextChanged={e => emitTyping(user.
Read more >
Getting baited onto react hooks! - Dasith's blog
... const onInputTextChange = e => { setInputUserName(e. ... you can do this if you want it to behave somewhat similar to componentDidUpdate....
Read more >
@starling-tech/react-native-gifted-chat - npm package | Snyk
<GiftedChat text={customText} onInputTextChanged={text => this.setCustomText(text)} /* ... */ />. Notes for Android. If you are using Create React Native ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found