@@ -171,6 +171,7 @@ export default class ViewSlider extends React.Component<Props, State> {
171
171
// phase 1: set current height
172
172
newState = {
173
173
height : this . measureHeight ( this . views [ this . state . activeView ] ) ,
174
+ numViews : Math . max ( this . state . numViews , activeView + 1 ) ,
174
175
}
175
176
} else if ( this . state . height !== undefined && ! this . state . transitioning ) {
176
177
// phase 2: enable transitions
@@ -253,6 +254,10 @@ export default class ViewSlider extends React.Component<Props, State> {
253
254
if ( rtl ) style . marginRight = `${ ( spacing - 1 ) * 100 } %`
254
255
else style . marginLeft = `${ ( spacing - 1 ) * 100 } %`
255
256
}
257
+ if ( ! transitioning && activeView !== index ) {
258
+ style . height = 0
259
+ style . overflow = 'hidden'
260
+ }
256
261
257
262
// when not transitioning, render empty placeholder divs before the active view to push it into the right
258
263
// horizontal position
@@ -281,9 +286,8 @@ export default class ViewSlider extends React.Component<Props, State> {
281
286
}
282
287
283
288
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
287
291
}
288
292
289
293
rootRef = ( node : ?React . ElementRef < 'div' > ) => {
0 commit comments