React Material UI工具提示禁用动画 [英] React Material UI Tooltips Disable Animation

查看:60
本文介绍了React Material UI工具提示禁用动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在React应用程序中使用React Material UI的工具提示组件.

I'm using React Material UI's Tooltip Component in my React application.

import Tooltip from "@material-ui/core/Tooltip";
...
...
<Tooltip title="Add" arrow>
    <Button>Arrow</Button>
</Tooltip>
...
...

我想禁用进入和退出动画.如何在最新版本中实现此目标

I want to disable the entry and exit animations. How can I achieve this in the latest version

推荐答案

只需禁用/模拟过渡组件.即:像这样自动渲染孩子:

Just disable/mock the transition component. ie: render automatically the children like this:

const FakeTransitionComponent =({子元素})=>孩子;

<Tooltip
  title="tooltip title"
  TransitionComponent={FakeTransitionComponent}
  // or TransitionComponent={({ children}) => children}
>
  <h1>Hello CodeSandbox</h1>
</Tooltip>

这是一个 codesandbox演示

这篇关于React Material UI工具提示禁用动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆