> For the complete documentation index, see [llms.txt](https://minwork.gitbook.io/long-press-hook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minwork.gitbook.io/long-press-hook/migration/v2-to-v3.md).

# V2 to V3

## \[BREAKING CHANGE] Drop support for `'both'` option in `detect` param

Returning both mouse and touch handlers as a hook result caused unintended edge cases on touch devices that emulated clicks. Therefore `'both'` value was removed and hook is now using `'pointer'` as a default value for `detect` param.

This also enables to support more type of events in the future.

Pointer events should be sufficient replacement for `'both'` option, but you can also programmatically detect if current device support touch events and set proper `detect` value based on that.

### *Before*

```tsx
const bind = useLongPress(() => console.log('Long pressed'), {
  detect: 'both',
})
```

### *After*

```tsx
const bind = useLongPress(() => console.log('Long pressed'), {
  detect: 'pointer',
})
```

## \[BREAKING CHANGE] Typings and param values

TypeScript's typings were refactored to use more consistent and precise names. Also changed callback *reason* values (see `LongPressEventReason`)

* Changed generics order from `useLongPress<Target, Callback, Context>` to `useLongPress<Target, Context, Callback>`
* Renamed `LongPressDetectEvents` enum to `LongPressEventType`
  * `LongPressDetectEvents.MOUSE` -> `LongPressEventType.Mouse`
  * `LongPressDetectEvents.TOUCH` -> `LongPressEventType.Touch`
* Added `LongPressEventType.Pointer`
* Renamed `LongPressEventReason` enum to `LongPressCallbackReason`
  * `LongPressEventReason.CANCELED_BY_MOVEMENT` ('cance**l**ed-by-movement') -> `LongPressCallbackReason.CancelledByMovement` ('cance**ll**ed-by-movement')
  * `LongPressEventReason.CANCELED_BY_TIMEOUT` ('cance**l**ed-by-timeout') -> `LongPressCallbackReason.CancelledByRelease` ('cance**ll**ed-by-release')
* Removed `Coordinates` type
* Renamed `EmptyObject` type to `LongPressEmptyHandlers`
* Renamed `CallableContextResult` type to `LongPressResult`
* Renamed `LongPressResult` type to `LongPressHandlers`
* Added mouse and touch handlers types - `LongPressMouseHandlers` and `LongPressTouchHandlers`
