File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 38
38
.text-rotater__wrap {
39
39
display : inline-flex ;
40
40
flex-direction : column ;
41
- }
41
+ text-align : left ;
42
+ }
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export default class TextRotater extends React.PureComponent {
51
51
}
52
52
53
53
render ( ) {
54
- const { children } = this . props ;
54
+ const { children, maxWidth } = this . props ;
55
55
const { currentIndex, contentHeight } = this . state ;
56
56
const childrenCount = React . Children . count ( children ) ;
57
57
@@ -65,7 +65,7 @@ export default class TextRotater extends React.PureComponent {
65
65
className = "text-rotater__wrap"
66
66
ref = { trw => ( this . textRotatorWrap = trw ) }
67
67
onTransitionEnd = { this . handleTransitionEnd }
68
- style = { { height : contentHeight } }
68
+ style = { { height : contentHeight , width : maxWidth } }
69
69
>
70
70
{ currentChild }
71
71
{ nextChild }
@@ -85,5 +85,8 @@ TextRotater.propTypes = {
85
85
children : PropTypes . arrayOf ( PropTypes . node ) ,
86
86
delay : PropTypes . number ,
87
87
repeatDelay : PropTypes . number ,
88
+ // Needed to prevent jump when
89
+ // rotating between texts of different widths
90
+ maxWidth : PropTypes . number ,
88
91
} ;
89
92
You can’t perform that action at this time.
0 commit comments