Skip to content

SwipeableItem

SwipeableItem wraps any content to enable horizontal swipe gestures revealing action buttons. Supports left and right actions, full-swipe triggers, collapse-dismiss animation, and haptic feedback.

Usage

SwipeableExample.tsx
import { SwipeableItem } from '@masumdev/rn-ui';
import { Trash2, Archive } from 'lucide-react-native';
export function SwipeableExample() {
return (
<SwipeableItem
leftActions={[
{
label: 'Archive',
icon: (p) => <Archive {...p} />,
tone: 'primary',
onPress: () => console.log('Archived'),
},
]}
rightActions={[
{
label: 'Delete',
icon: (p) => <Trash2 {...p} />,
tone: 'danger',
isDestructive: true,
onPress: () => console.log('Deleted'),
},
]}
>
<Item>
<ItemContent>
<ItemTitle>Swipe me left or right</ItemTitle>
</ItemContent>
</Item>
</SwipeableItem>
);
}

Ref Methods

MethodDescription
close()Close revealed actions
openLeft()Programmatically reveal left actions
openRight()Programmatically reveal right actions
dismiss(callback?)Collapse-dismiss the row with animation

Props API

PropTypeDefaultDescription
children*React.ReactNodeRow content to render.
leftActionsSwipeableAction[]Actions revealed on right swipe.
rightActionsSwipeableAction[]Actions revealed on left swipe.
actionWidthnumber72Width of each action button.
fullSwipeThresholdnumber0.6Threshold (0-1) to trigger full swipe.
onFullSwipeLeft() => voidCallback on full left swipe.
onFullSwipeRight() => voidCallback on full right swipe.
hapticFeedbackbooleantrueEnable haptic feedback.
disabledbooleanfalseDisable swipe gestures.

SwipeableAction

PropTypeDefaultDescription
labelstringAction button label.
iconRenderIconAction button icon.
toneComponentToneColor tone for the action.
backgroundColorstringCustom background color override.
isDestructivebooleanMark as destructive (enables full-swipe delete).
onPress() => voidAction press callback.
closeOnPressbooleantrueAuto-close after press.