Skip to content

Commit

Permalink
fix: fix typing of togglebutton clone
Browse files Browse the repository at this point in the history
  • Loading branch information
annarieger committed Nov 16, 2022
1 parent 32a13e0 commit 67dd940
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Button/ToggleGroup/ToggleGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ class ToggleGroup extends React.Component<ToggleGroupProps, ToggleGroupState> {
: 'horizontal-toggle-group';

const childrenWithProps = React.Children.map(children, child => {
if (React.isValidElement(child)) {
const item = child as React.ReactElement<ToggleButtonProps>;
if (React.isValidElement(item)) {
// pass the press state through to child components
return React.cloneElement(child, {
// @ts-ignore
pressed: this.state.selectedName === child.props.name
return React.cloneElement(item, {
pressed: this.state.selectedName === item.props.name
});
} else {
return child;
Expand Down

0 comments on commit 67dd940

Please sign in to comment.