Skip to content

FloatingPanel #6950

@wzx2002

Description

@wzx2002

Version of antd-mobile

5.39.0

Operating system and its version

No response

Browser and its version

No response

Sandbox to reproduce

No response

What happened?

FloatingPanel 没有触发 onHeightChange事件

import {useRef} from 'react';
import {FloatingPanel, List} from 'antd-mobile';

function App() {
    const ref = useRef(null);
    const data = ['A', 'B', 'C', 'D', 'E'];

    const anchors = [
        100,
        Math.round(window.innerHeight * 0.4),
        Math.round(window.innerHeight * 0.8)
    ];

    return (
        <FloatingPanel
            ref={ref}
            anchors={anchors}
            handleDraggingOfContent={true}
            onHeightChange={(height, animating) => {
                console.log('拖拽高度:', height, '动画中:', animating);
            }}
        >
            <List>
                {data.map((item, index) => (
                    <List.Item key={index}>{item}</List.Item>
                ))}
            </List>
        </FloatingPanel>
    );
}

export default App;

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions