Skip to content

Commit

Permalink
[SpeedDial] Fix crash when using custom style in FabProps (#18320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weslen do Nascimento authored and oliviertassinari committed Nov 12, 2019
1 parent a26446f commit 8306c25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api/speed-dial-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
|:-----|:-----|:--------|:------------|
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">delay</span> | <span class="prop-type">number</span> | <span class="prop-default">0</span> | Adds a transition delay, to allow a series of SpeedDialActions to be animated. |
| <span class="prop-name">FabProps</span> | <span class="prop-type">object</span> | | Props applied to the [`Fab`](/api/fab/) component. |
| <span class="prop-name">FabProps</span> | <span class="prop-type">object</span> | <span class="prop-default">{}</span> | Props applied to the [`Fab`](/api/fab/) component. |
| <span class="prop-name">icon</span> | <span class="prop-type">node</span> | | The Icon to display in the SpeedDial Fab. |
| <span class="prop-name">TooltipClasses</span> | <span class="prop-type">object</span> | | Classes applied to the [`Tooltip`](/api/tooltip/) element. |
| <span class="prop-name">tooltipOpen</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Make the tooltip always visible when the SpeedDial is open. |
Expand Down
11 changes: 5 additions & 6 deletions packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
classes,
className,
delay = 0,
FabProps,
FabProps = {},
icon,
id,
open,
Expand All @@ -103,19 +103,18 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {

const transitionStyle = { transitionDelay: `${delay}ms` };

if (FabProps && FabProps.style) {
FabProps.style.transitionDelay = `${delay}ms`;
}

const fab = (
<Fab
size="small"
className={clsx(classes.fab, !open && classes.fabClosed, className)}
tabIndex={-1}
role="menuitem"
style={transitionStyle}
aria-describedby={`${id}-label`}
{...FabProps}
style={{
...transitionStyle,
...FabProps.style,
}}
>
{icon}
</Fab>
Expand Down

0 comments on commit 8306c25

Please sign in to comment.