Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ellipsis] 当 Ellipsis 处于 forceRender 的 tab 中,tab 第一次变为可见时,Ellipsis 会闪烁 #6063

Open
KingAmo opened this issue Mar 23, 2023 · 4 comments

Comments

@KingAmo
Copy link

KingAmo commented Mar 23, 2023

Version of antd-mobile

5.28.1

Operating system and its version

Others

Browser and its version

chorme 111

Sandbox to reproduce

https://codesandbox.io/s/nifty-moore-451y9s?file=/src/App.tsx

What happened?

当 Ellipsis 处于 forceRender 的 tab 中,tab 第一次变为可见时,Ellipsis 会闪烁(没隐藏超出部分 -> 隐藏超出部分)

期望:tab 第一次变为可见时,Ellipsis 正常展示(正常隐藏超出的部分),不发生闪烁。

Relevant log output

No response

@1587315093
Copy link
Contributor

display:none 有关 ,以下代码即可复现

import React, { useState } from "react";
import { Ellipsis } from "antd-mobile";

const content = `图表中空间有限,文本内容无法完全显示图表中空间有限,
文本内容无法完全显示图表中空间有限,文本内容无法完全显示图表中空间有限,
文本内容无法完全显示图表中空间有限,文本内容无法完全显示图表中空间有限,
文本内容无法完全显示图表中空间有限,文本内容无法完全显示图表中空间有限,
文本内容无法完全显示`;

export default function App() {
  const [state, setState] = useState(false);
  return (
    <div className="App">
      <Ellipsis
        content={content}
        style={{ display: state ? "block" : "none" }}
      />
      <button onClick={() => setState(true)}>点击</button>
    </div>
  );
}

@KingAmo
Copy link
Author

KingAmo commented Jul 5, 2023

#6155 这个 pr 说是解决了这个问题, 我看已经发布了新版本了。但是经过验证,antd-mobile最新版本 5.31.1 仍然有这个问题,see https://codesandbox.io/s/nifty-moore-451y9s?file=/src/App.tsx

@1587315093
Copy link
Contributor

#6155 这个 pr 说是解决了这个问题, 我看已经发布了新版本了。但是经过验证,antd-mobile最新版本 5.31.1 仍然有这个问题,see https://codesandbox.io/s/nifty-moore-451y9s?file=/src/App.tsx

好吧 当初盯着 display 案例修,没注意到这个 forceRender ,

@1587315093
Copy link
Contributor

应该是加上 padding 后,容器计算问题
https://codesandbox.io/s/distracted-dubinsky-h9hm8x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants