marekrozmus / react-swipeable-list

Swipeable list component for React supporting several behaviours (e.g. iOS)
https://marekrozmus.github.io/react-swipeable-list/
MIT License
110 stars 20 forks source link

Delay on LeadingAction #27

Open Mario8419 opened 1 year ago

Mario8419 commented 1 year ago

I want to make a little icon animation before the Swipe back onClick but it disappears before and the destructiveCallbackDelay isn't working! Any workaround for this problem? thanks

marekrozmus commented 1 year ago

Hi, do I understand correctly that you would like the swipe back animation to start after the icon's animation is ended? Now it starts to swipe back after click.

Mario8419 commented 1 year ago

exactly

marekrozmus commented 1 year ago

@Mario8419 Added actionDelay parameter which will delay the animation and action triggering for specified time.

Mario8419 commented 1 year ago

thanks for adding actionDelay prop, but the problem is that the animation renders in SwipeAction and so it's the same effect like before.

const handleFavoriteCategorySwipe = (id, value) => (
      <LeadingActions>
         <SwipeAction
            onClick={() => updateCategoryFavorite(id, value )}
         >
            <span>
              {data.favorite ?
                  <FavoriteOnIcon /> 
                :
                  <img src={favoriteOffIcon} alt='Favorite-Off-Icon' /> 
              }
            </span>
          </SwipeAction>
        </LeadingActions>
      )
marekrozmus commented 1 year ago

ok, my bad. Do I understand correctly then we should have separate delay for starting "return animation" and separate for triggering action?