Fix timeline jumps (#10001)
* Avoid two-step rendering of statuses as much as possible Cache width shared by Video player, MediaGallery and Cards at the ScrollableList level, pass it down through StatusList and Notifications. * Adjust scroll when new preview cards appear * Adjust scroll when statuses above the current scroll position are deleted
This commit is contained in:
		@@ -61,6 +61,8 @@ export default class Card extends React.PureComponent {
 | 
			
		||||
    maxDescription: PropTypes.number,
 | 
			
		||||
    onOpenMedia: PropTypes.func.isRequired,
 | 
			
		||||
    compact: PropTypes.bool,
 | 
			
		||||
    defaultWidth: PropTypes.number,
 | 
			
		||||
    cacheWidth: PropTypes.func,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  static defaultProps = {
 | 
			
		||||
@@ -69,7 +71,7 @@ export default class Card extends React.PureComponent {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  state = {
 | 
			
		||||
    width: 280,
 | 
			
		||||
    width: this.props.defaultWidth || 280,
 | 
			
		||||
    embedded: false,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@@ -112,6 +114,7 @@ export default class Card extends React.PureComponent {
 | 
			
		||||
 | 
			
		||||
  setRef = c => {
 | 
			
		||||
    if (c) {
 | 
			
		||||
      if (this.props.cacheWidth) this.props.cacheWidth(c.offsetWidth);
 | 
			
		||||
      this.setState({ width: c.offsetWidth });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user