@@ -502,6 +502,36 @@ class SwipeableListItem extends PureComponent {
502502 this . resetState ( ) ;
503503 }
504504 }
505+
506+ this . fixFinalWidth ( ) ;
507+ } ;
508+
509+ fixFinalWidth = ( ) => {
510+ const { leadingOffset = 0 , trailingOffset = 0 } = this . props ;
511+
512+ if ( this . leadingActionsElement ) {
513+ const leadingActionsWidth = parseInt (
514+ this . leadingActionsElement . style . width
515+ ) ;
516+
517+ if ( leadingActionsWidth > 0 ) {
518+ this . leadingActionsElement . style . width = `${
519+ leadingActionsWidth + leadingOffset
520+ } px`;
521+ }
522+ }
523+
524+ if ( this . trailingActionsElement ) {
525+ const trailingActionsWidth = parseInt (
526+ this . trailingActionsElement . style . width
527+ ) ;
528+
529+ if ( trailingActionsWidth > 0 ) {
530+ this . trailingActionsElement . style . width = `${
531+ trailingActionsWidth + trailingOffset
532+ } px`;
533+ }
534+ }
505535 } ;
506536
507537 dragStartedWithinItem = ( ) => {
@@ -656,6 +686,8 @@ class SwipeableListItem extends PureComponent {
656686 } px`;
657687 }
658688
689+ this . fixFinalWidth ( ) ;
690+
659691 if ( this . listElement ) {
660692 if ( fullSwipe ) {
661693 const {
@@ -709,7 +741,6 @@ class SwipeableListItem extends PureComponent {
709741 }
710742 }
711743 }
712-
713744 this . startTime = Date . now ( ) ;
714745 } ;
715746
@@ -822,6 +853,8 @@ SwipeableListItem.propTypes = {
822853 swipeStartThreshold : PropTypes . number ,
823854 threshold : PropTypes . number ,
824855 trailingActions : PropTypes . node ,
856+ leadingOffset : PropTypes . number ,
857+ trailingOffset : PropTypes . number ,
825858} ;
826859
827860export default SwipeableListItem ;
0 commit comments