-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to forward refs in Bar and Path components (#2673)
Co-authored-by: Cesar Perez <[email protected]>
- Loading branch information
Cesar Perez
and
Cesar Perez
authored
Nov 15, 2023
1 parent
6dc9f10
commit c9991c7
Showing
4 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"victory-bar": minor | ||
"victory-core": minor | ||
--- | ||
|
||
added ref forwarding for path and bar components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import React from "react"; | ||
import React, { forwardRef } from "react"; | ||
import { VictoryPrimitiveShapeProps } from "./types"; | ||
|
||
export const Path = (props: VictoryPrimitiveShapeProps) => { | ||
// eslint-disable-next-line prefer-arrow-callback | ||
export const Path = forwardRef(function Path( | ||
props: VictoryPrimitiveShapeProps, | ||
ref, | ||
) { | ||
// eslint-disable-next-line react/prop-types | ||
const { desc, ...rest } = props; | ||
return desc ? ( | ||
// @ts-expect-error FIXME: "id cannot be a number" | ||
<path {...rest}> | ||
<path {...rest} ref={ref}> | ||
<desc>{desc}</desc> | ||
</path> | ||
) : ( | ||
// @ts-expect-error FIXME: "id cannot be a number" | ||
<path {...rest} /> | ||
<path {...rest} ref={ref} /> | ||
); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c9991c7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
victory – ./
victory-git-main-formidable-labs.vercel.app
victory-formidable-labs.vercel.app
victory-rose.vercel.app