-
Notifications
You must be signed in to change notification settings - Fork 472
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
Height not updating on selected view #535
Comments
After taking a look at the For example, here it is called when the user swipes to the node:
And this does update the height in my demo too. However, when receiving new |
Maybe it would make sense to check |
I've opened a PR to fix this here. |
Until this PR is merged, I've been able to workaround this by calling the following when I want to recompute height manually: // Recompute height
this.swipeableViewsRef.current
.getChildContext()
.swipeableViews.slideUpdateHeight()
// In render
<SwipeableViews ref={this.swipeableViewsRef} {...props} /> |
i have this issue too, and that fix didn't work for me in a functional component :( |
Expected Behavior
When using
animateHeight={true}
the height of each container (view) should be automatically be updated according to their content.When
animateHeight={false}
this problem does not occur. Every view's height is the same as the maximum view of any view, and that updates correctly when there is new content.Current Behavior
Right now, only the currently active view will not update its height. The rest of the views update themselves correctly in terms of height.
My use case is a chat application. A new message received won't be displayed if I'm in the current view. It just won't update the height of my container. However, if I swipe to another view and back, it renders correctly along with the correct container (view) height.
I'm supplying new messages as
props
to areact
component which uses<SwipeableViews />
to then render them. As far as I can tell, the elements do appear in DOM as they should. Just theheight
of the view ofreact-swipeable-views
is not updating itself.Steps to Reproduce (for bugs)
A small demo I made to display this problem:
https://codesandbox.io/s/clever-margulis-kswpt?fontsize=14
Open it in browser's mobile view and swipe to the left and back.
New messages received through the
props
should increase the height of the currently active container but they do not.Your Environment
Browser environment.
The text was updated successfully, but these errors were encountered: