@@ -171,6 +171,7 @@ export default class ViewSlider extends React.Component<Props, State> {
171171 // phase 1: set current height
172172 newState = {
173173 height : this . measureHeight ( this . views [ this . state . activeView ] ) ,
174+ numViews : Math . max ( this . state . numViews , activeView + 1 ) ,
174175 }
175176 } else if ( this . state . height !== undefined && ! this . state . transitioning ) {
176177 // phase 2: enable transitions
@@ -253,6 +254,10 @@ export default class ViewSlider extends React.Component<Props, State> {
253254 if ( rtl ) style . marginRight = `${ ( spacing - 1 ) * 100 } %`
254255 else style . marginLeft = `${ ( spacing - 1 ) * 100 } %`
255256 }
257+ if ( ! transitioning && activeView !== index ) {
258+ style . height = 0
259+ style . overflow = 'hidden'
260+ }
256261
257262 // when not transitioning, render empty placeholder divs before the active view to push it into the right
258263 // horizontal position
@@ -281,9 +286,8 @@ export default class ViewSlider extends React.Component<Props, State> {
281286 }
282287
283288 animateHeight = ( ) : boolean => {
284- const { animateHeight, fillParent, keepViewsMounted } =
285- this . getDefaultedProps ( )
286- return animateHeight && ! fillParent && ! keepViewsMounted
289+ const { animateHeight, fillParent } = this . getDefaultedProps ( )
290+ return animateHeight && ! fillParent
287291 }
288292
289293 rootRef = ( node : ?React . ElementRef < 'div' > ) => {
0 commit comments