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 的滑动操作组件,通过主线程手势提供可滑动列表项基础能力。
    环境要求

    LynxSDK 版本 >= 2.16

    @lynx-js/react 版本 > 0.24

    // pageConfig
    import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
    
    pluginReactLynx({
      enableNewGesture: true,
    }),
    Info

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

    示例

    SwipeActionProps

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

    SwipeActionRef

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