Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Performace] After chatting for a while input box start taking delay to show typed message in input box. #840

Closed
Suraj-Tiwari opened this issue Apr 20, 2018 · 13 comments
Labels

Comments

@Suraj-Tiwari
Copy link

Suraj-Tiwari commented Apr 20, 2018

Issue Description

After chatting for some time. When user types it takes a while to appear in message input box (Delay Varies by devices);

Steps to Reproduce / Code Snippets

Keep chatting for a long time with same user.

Expected Results

Smooth work

[FILL THIS OUT]

Additional Information

After chatting for some time. When user types it takes a while to appear in message input box (Delay Varies by devices);

  • Nodejs version: [9.3.0]
  • React version: [16.3.1]
  • React Native version: [0.55.2]
  • react-native-gifted-chat version: [0.4.3]
  • Platform(s) (iOS, Android, or both?): [ANDROID]
@Suraj-Tiwari
Copy link
Author

Ok I found a solution
Commenting this line resolved performance issue.

Issue: When user enter large text (50+ characters) and remove it then repeat process again 2 or more times. Then composer freeze Removing/commenting that line resolved that issue

Composer.js#L43

@Suraj-Tiwari
Copy link
Author

@FaridSafi Please add this solution in readme. This might help other users.

@rzdev
Copy link

rzdev commented May 8, 2018

@Suraj-Tiwari Thanks so much for this, i have this problem too.

My issue on Lag
#850

aminosman added a commit to aminosman/react-native-gifted-chat that referenced this issue May 9, 2018
@Waltari10
Copy link

Same here! I don't understand though why this is fixing the problem. 🤔 Isn't this the exact way that react-native recommends doing TextInput? How can it slow down Android?https://facebook.github.io/react-native/docs/textinput.html

@Waltari10
Copy link

I think what is happening that each time input changes, it is set to the state of the parent gifted chat. This causes every single component under giftedChat to be rerendered, because the text is passed as prop everywhere. On iOS this doesn't seem to be an issue, but on Android the rerendering is quite slow. If this is true, it is a rather fundamental problem with the package.

@Waltari10
Copy link

Possibly related issue: facebook/react-native#18916

@ahartzog
Copy link

ahartzog commented Jun 6, 2018

Commenting out the line breaks text clearing on iOS for me, this appears to resolve it well:

value={Platform.OS === 'ios' ? this.props.text : null}

@OSPFNeighbour
Copy link

+1

Without this my JS and UI FPS drop to about 3fps while typing. with this fix applied they stay at about 50fps

@akiladevinda
Copy link

simply comment " value={this.props.text} " in Composer.js file inside react-native-gifted-chat node module folder

@iamrommel
Copy link

No pull request for this?

@richeterre
Copy link

@ahartzog, if make the change you suggested

value={Platform.OS === 'ios' ? this.props.text : null}

the input field no longer gets cleared when I submit a message. Does this not happen for you? I'm on version 0.4.3.

@stale
Copy link

stale bot commented Feb 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 12, 2019
@stale stale bot closed this as completed Feb 19, 2019
@aamir0
Copy link

aamir0 commented May 30, 2019

With the suggested fix of value={Platform.OS === 'ios' ? this.props.text : null}, the box clears on Android, but it takes a second or so. If you start typing in that time (which isn't hard to do), the box won't clear at all.

howg0924 added a commit to howg0924/react-native-gifted-chat that referenced this issue Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants