Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/components/Service/Tappable/Tappable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AllHTMLAttributes, ElementType, forwardRef } from 'react';
import styles from './Tappable.module.css';

import { classNames } from 'helpers/classNames';
import { callMultiple } from 'helpers/function';
import { usePlatform } from 'hooks/usePlatform';

import { useRipple } from './components/Ripple/hooks/useRipple';
Expand All @@ -21,10 +22,16 @@ export const Tappable = forwardRef(({
className,
interactiveAnimation = 'background',
readOnly,
onPointerDown,
onPointerCancel,
...restProps
}: TappableProps, ref) => {
const platform = usePlatform();
const { clicks, onPointerCancel, onPointerDown } = useRipple();
const { clicks, onPointerCancel: handleRipplePointerCancel, onPointerDown: handleRipplePointerDown } = useRipple();

const handlePointerDown = callMultiple(onPointerDown, handleRipplePointerDown);

const handlePointerCancel = callMultiple(onPointerCancel, handleRipplePointerCancel);

const hasRippleEffect = platform === 'base' && interactiveAnimation === 'background' && !readOnly;
return (
Expand All @@ -36,8 +43,8 @@ export const Tappable = forwardRef(({
interactiveAnimation === 'opacity' && styles['wrapper--opacity'],
className,
)}
onPointerCancel={onPointerCancel}
onPointerDown={onPointerDown}
onPointerCancel={handlePointerCancel}
Comment thread
Wriklend marked this conversation as resolved.
onPointerDown={handlePointerDown}
readOnly={readOnly}
{...restProps}
>
Expand Down