marekrozmus / react-swipeable-list

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

Delay on LeadingAction #27

Open Mario8419 opened 2 years ago

Mario8419 commented 2 years 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 2 years 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 2 years ago

exactly

marekrozmus commented 2 years ago

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

Mario8419 commented 2 years 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 2 years ago

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