react-component / react-component/trigger

The 'popupVisible' not work

未关闭
#307 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
391
派生
245
PR 合并指标
30 天内没有已合并 PR

描述

I use 'popupVisible' and 'onPopupVisibleChange' with React.useState,but popup won't close once opened

import React, { useState } from "react";
import "antd/dist/antd.css";

import Trigger from "rc-trigger";
import { List, Button } from "antd";

import "./index.css";

const App = () => {
  const [visible, setVisible] = useState(false)

  console.log(`visible`, visible)

  return (
    <div className="wrapper">
      <Trigger
        popupVisible={visible}
        action={["click"]}
        // destroyPopupOnHide={true}
        popup={<span>popup</span>}
        popupAlign={{
          points: ['tl', 'tr'],
          // offset: [0, 3]
        }}
        onPopupVisibleChange={(a) => {
          console.log('a', a)
          setVisible(a);
        }}
      >
        <Button block >+++</Button>
      </Trigger>
    </div>
  );
};

export default App;

Edit 垂直菜单 - antd@4.23.0 (forked)

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 CodeSandbox 复现开始,在点击按钮时跟踪 Trigger 组件的 popupVisible 和 onPopupVisibleChange 行为。完成的标准是弹出层打开后再关闭,同时受控的 React 状态与组件保持同步。

由索引模型根据 Issue 内容生成。

评估

技术栈
react, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。