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

Does not scroll to bottom if the incoming message contains an external image. #95

Open
medberg opened this issue Jun 26, 2018 · 3 comments

Comments

@medberg
Copy link

medberg commented Jun 26, 2018

If the incoming message contains an image, for example:

<img src="http://via.placeholder.com/350x350" />

the StayScrolled component doesn't stay scrolled. This is presumably because the image is loaded asynchronously into the dom. Is there a recommended workaround for this? Thanks, and great job on this library!

@medberg
Copy link
Author

medberg commented Jun 28, 2018

For anyone running into this same issue, a simple and effective solution is to pass the stayScrolled function to the onLoad callback like this:

<img src="http://via.placeholder.com/350x350" onLoad={this.props.stayScrolled} />

@medberg medberg closed this as completed Jun 28, 2018
@perrin4869
Copy link
Collaborator

@medberg Sorry for the late reply!
Thanks for finding the solution to the issue :)
Let me reopen this because there should probably be an example showing how to do this.
I'd greatly appreciate it if you could submit one, otherwise I'll get around to adding one!

@perrin4869 perrin4869 reopened this Jul 16, 2018
@Mattgh91
Copy link

Excellent solve, thanks! Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants