For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/components/feedback/popup.md.

popup

浮层弹出组件,从屏幕边缘滑入的容器,支持顶部、底部、左侧、右侧等方向。

扫码预览

扫码预览 popup

Props

属性名类型默认值必填说明
adjustExitTransitionByContentHeightbooleanfalse否根据内容高度动态调整退出动画。启用后,屏幕上的动画持续时间保持不变。因此,内容高度越大,退出速度越快,以确保动画在固定时间内完成。
allowDragBeyondBottombooleanfalse否如果为 true,则允许组件在拖动时超出底部边界。
autoHeightboolean-否自动弹窗高度,设置为 true 时,需要指定 contentId 属性,弹窗高度会根据内容高度动态变化,拖动区域在底部和当前高度之间,initHeight 和 maxHeight 不再有效
bottomNodeReactElement<any, string | JSXElementConstructor<any>>-否固定在弹窗底部的节点,不会受到拖动影响
children(prop: RenderFunction) => ReactElement-是弹窗的子元素
closeOnMaskClickbooleantrue否设置为 true 时,点击遮罩会关闭弹窗
contentIdstring-否弹窗内容的 ID, 在 autoHeight 为 true 时需要设置,用于获取内容高度
contentStyleCSSProperties-否弹窗内容的样式
enableBouncesbooleantrue否是否需要松手回弹
enableDragbooleantrue否是否启用拖动
enableScrollContainerDraggablebooleantrue否是否允许触摸在内部滚动容器区域时可拖拽Popup
enterDurationnumber300否进入动画持续时间(毫秒)
enterEasingFunctionstring'all ease-out'否显示动画过渡效果
exitDurationnumber300否退出动画持续时间(毫秒)
exitEasingFunctionstring'all ease-out'否隐藏动画过渡效果
heightPercentHeightPercent-否弹窗的高度百分比
main-thread:gestureBaseGesture<BaseGestureConfig, GestureChangeEvent>-否如果你想使用手势,请使用这个属性
maskEventThroughbooleanfalse否当设置为true的时候,遮罩事件会传递到子元素
maskStyleCSSProperties-否遮罩的样式
maxHeightnumberscreenHeight是理论上能拖拽到的最大高度,当使用overlayMode时需要传入屏幕高度,当不使用overlayMode时,需要传入当前LynxView的高度
onDrag(eventParam: OnDragCallback) => void-否拖动回调
onPopupPositionChange(position: number) => void-否弹窗位置回调
onPopupTopChange(height: number) => void-否弹窗高度变化回调
onRequestClose() => void-否是否左滑或者点击返回键
preloadbooleantrue否弹窗创建时预加载,这样在 visible 为 true 时会加快显示速度
refForwardedRef<PopupRef>-否-
scrollContainerIdstring-是根节点滚动容器的 ID(必需)
stopGesturePropagationWhenScrollAtTopbooleanfalse否当滚动容器滚动到顶部时,停止滚动容器的手势事件传播。

Ref 方法

方法名类型说明
close() => void关闭弹窗
open(position?: PopupStatus) => void打开弹窗, 弹窗位置 0(中心)1(顶部)-1(底部),默认是中心
setScrollContainerScrollEnabled(enabled: boolean) => Promise<void>不受当前弹窗位置限制,设置滚动容器是否允许原生滚动:true 允许,false 禁止。主线程调用完成后返回的 Promise 才会完成。滚动容器首次收到触摸前调用无效,后续手势仍可能改变此设置。
translateTo(position: string | PopupStatus) => void移动弹窗到指定位置,0(中心)1(顶部)-1(底部)