File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -282,13 +282,31 @@ class SwipeableListItem extends PureComponent {
282282 } ) ;
283283 } ;
284284
285+ get onlyLeftContent ( ) {
286+ return this . contentLeft !== null && this . contentRight === null ;
287+ }
288+
289+ get onlyRightContent ( ) {
290+ return this . contentLeft === null && this . contentRight !== null ;
291+ }
292+
285293 updatePosition = ( ) => {
286294 const now = Date . now ( ) ;
287295 const elapsed = now - this . startTime ;
288296
289297 if ( elapsed > FPS_INTERVAL && this . isSwiping ( ) ) {
290298 let contentToShow = this . left < 0 ? this . contentLeft : this . contentRight ;
291299
300+ if ( this . onlyLeftContent && this . left > 0 ) {
301+ this . left = 0 ;
302+ contentToShow = this . contentLeft ;
303+ }
304+
305+ if ( this . onlyRightContent && this . left < 0 ) {
306+ this . left = 0 ;
307+ contentToShow = this . contentRight ;
308+ }
309+
292310 if ( ! contentToShow ) {
293311 return ;
294312 }
You can’t perform that action at this time.
0 commit comments