Skip to main content

Provides swipe gestures detections for reflex apps.

Project description

Reflex Swipe

Detects swipes on the page. Wraps react-swipeable.

from reflex_swipe import swipeable

def index():
    return swipeable(
        "Swipe Here",
        on_swiped_left=rx.console_log("Swiped Left"),
        height="100px",
        width="100px",
    )

Supported Props

Prop Name Prop Type Description
delta float The min distance(px) before a swipe starts.
prevent_scroll_on_swipe bool Prevents scroll during swipe.
track_touch bool Track touch input.
track_mouse bool Track mouse input.
rotation_angle float Set a rotation angle.
swipe_duration float Allowable duration of a swipe (ms).

Supported Events

Event Name Event Type
on_swiped (SwipeEvent) -> Any
on_swiped_left (SwipeEvent) -> Any
on_swiped_right (SwipeEvent) -> Any
on_swiped_up (SwipeEvent) -> Any
on_swiped_down (SwipeEvent) -> Any
on_swiped_start (SwipeEvent) -> Any
on_swiping (SwipeEvent) -> Any
on_tap () -> Any
on_touch_start_or_mouse_down () -> Any
on_touch_end_or_mouse_up () -> Any

SwipeEvent is the following:

class SwipeEvent(TypedDict):
    """A swipe event."""

    # direction of swipe
    dir: Literal["Left", "Right", "Up", "Down"]
    # initial swipe [x,y]
    initial: Tuple[float, float]
    # true for the first event of a tracked swipe
    first: bool
    # x offset (current.x - initial.x)
    delta_x: float
    # y offset (current.y - initial.y)
    delta_y: float
    # absolute delta_x
    abs_x: float
    # absolute delta_y
    abs_y: float
    # √(absX^2 + absY^2) / time - "absolute velocity" (speed)
    velocity: float
    # [ deltaX/time, deltaY/time] - velocity per axis
    vxvy: Tuple[float, float]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reflex_swipe-1.1.1.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reflex_swipe-1.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file reflex_swipe-1.1.1.tar.gz.

File metadata

  • Download URL: reflex_swipe-1.1.1.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.4

File hashes

Hashes for reflex_swipe-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e388e693d9209bee8d4c44d52e167e0efda3c051480e40053b7c6a05cf0cbefb
MD5 35b0b28eb2a2fa0fedd27b60025b8f22
BLAKE2b-256 7623143f18e1a09429cd1f51bbbb9ddf7a99b44496e715ceebfb6b799bd2d762

See more details on using hashes here.

File details

Details for the file reflex_swipe-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for reflex_swipe-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f49f52f73ebff0c99af4606f1a3b6851059a79ad326a990c5ddf52bcb6a374d
MD5 14402505a9764aeb227dd586ad26c79f
BLAKE2b-256 70fa1815ea2e6860e88dabb1e10049fc9a9b232ee843dca5accfd3e1e92b23cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page