Skip to content

Commit

Permalink
[feat] HoldItem: add new prop - longPressMinDurationMs (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
kesha-antonov authored Apr 5, 2023
1 parent 99c663b commit e504596
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/holdItem/HoldItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const HoldItemComponent = ({
hapticFeedback,
actionParams,
closeOnTap,
longPressMinDurationMs = 150,
children,
}: HoldItemProps) => {
//#region hooks
Expand Down Expand Up @@ -397,7 +398,7 @@ const HoldItemComponent = ({
default:
return ({ children: handlerChildren }: GestureHandlerProps) => (
<LongPressGestureHandler
minDurationMs={150}
minDurationMs={longPressMinDurationMs}
onHandlerStateChange={gestureEvent}
>
{handlerChildren}
Expand Down
9 changes: 9 additions & 0 deletions src/components/holdItem/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ export type HoldItemProps = {
* closeOnTap={true}
*/
closeOnTap?: boolean;

/**
* Set delay before long tap will activate gesture. May be useful to increase this value in lists
* @type number
* @default 150
* @examples
* longPressMinDurationMs={250}
*/
longPressMinDurationMs?: number;
};

export type GestureHandlerProps = {
Expand Down
14 changes: 14 additions & 0 deletions website/docs/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,17 @@ Set true if you want to close menu when tap to HoldItem
```tsx
<HoldItem closeOnTap />
```

### `longPressMinDurationMs`

Set delay before long tap will activate gesture. May be useful to increase this value in lists

| type | default | required |
| ------- | ------- | -------- |
| number | 150 | NO |

#### Example

```tsx
<HoldItem longPressMinDurationMs={250} />
```

0 comments on commit e504596

Please sign in to comment.