For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/ui/components/swipe-action.md.
lynx-ui logo
lynx-ui
  • 简体中文
  • SwipeAction

    一个适用于 ReactLynx 的滑动操作组件,通过主线程手势提供可滑动列表项基础能力。
    Info

    你可以查看源码来了解它的运行原理,也欢迎大家提 MR 来丰富其能力。

    基础用法

    结构

    SwipeAction 通过 displayArea 和 actionArea 暴露展示区和操作区这两个结构插槽。

    <SwipeAction
      displayArea={displayArea}
      actionArea={actionArea}
    />

    组件 API

    SwipeAction

    actionAreaiOSAndroid
    类型ReactElement
    SwipeAction 的内容。内容会显示在 SwipeAction 的右侧。在用手滚动或调用 showActionArea 前,actionArea 不会显示。
    classNameiOSAndroidHarmony
    类型string
    类名
    debugLogiOSAndroid
    类型boolean
    显示调试日志。当你发现 bug 时打开它
    displayAreaiOSAndroid
    类型ReactElement
    SwipeAction 的内容。内容会显示在 SwipeAction 的左侧。
    enableSwipeiOSAndroid
    类型boolean·默认值true
    是否允许滑动操作。当设置为 false 时,SwipeAction 只能用来显示内容。
    estimatedActionAreaSizeiOSAndroid
    类型number·默认值0
    actionArea 的大小。如果在 list 中使用 SwipeAction,list 的复用可能会导致操作区域大小错误。这个属性可用于指定一个初始大小,尽可能接近于排版渲染后的大小。
    iosEnableSimultaneousTouchiOS
    类型boolean·默认值true
    制触摸事件发送到 SwipeAction.
    onActioniOSAndroid
    类型(id: string) => void
    ActionArea 被点击时触发,可用于实现删除或其他操作。
    onSwipeEndiOSAndroid
    类型(id: string) => void
    SwipeAction 手动滚动结束时触发。
    onSwipeStartiOSAndroid
    类型(id: string) => void
    SwipeAction 手动滚动开始时触发。
    ref
    类型ForwardedRef<SwipeActionRef>
    styleiOSAndroidHarmony
    类型CSSProperties
    样式
    swipeActionIdiOSAndroid
    类型string
    SwipeAction 的id。

    SwipeActionRef

    closeActionAreaiOSAndroid
    类型(animated: boolean) => void
    调用以隐藏 actionArea. 如果 animated 为 true,则隐藏过程将带有动画效果。
    showActionAreaiOSAndroid
    类型(animated: boolean) => void
    调用以显示 actionArea。如果 animated 为 true,则显示过程将带有动画效果。
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。