Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reflex-swipe

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reflex-swipe

Provides swipe gestures detections for reflex apps.

  • 1.0.0
  • PyPI
  • Socket score

Maintainers
1

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 NameProp TypeDescription
deltafloatThe min distance(px) before a swipe starts.
prevent_scroll_on_swipeboolPrevents scroll during swipe.
track_touchboolTrack touch input.
track_mouseboolTrack mouse input.
rotation_anglefloatSet a rotation angle.
swipe_durationfloatAllowable duration of a swipe (ms).

Supported Events

Event NameEvent 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]

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc