Skip to content

Commit

Permalink
Merge pull request #9 from oeb25/master
Browse files Browse the repository at this point in the history
Add forwardRef to all components
  • Loading branch information
jsmith authored Aug 28, 2021
2 parents 0cc0057 + 7fbb0fb commit 6348ad6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ const processRepo = () => {
imports.push([path.join(name, outFileName), pascalName]);

let processed = contents.trim().split("\n").join("\n ");
processed = `<svg {...props} ${processed.substr(4)}`;
processed = `<svg {...props} ref={ref} ${processed.substr(4)}`;

fs.writeFileSync(
out,
`
import React from "react";
export const ${pascalName} = (props: React.SVGProps<SVGSVGElement>) => {
export const ${pascalName} = React.forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>((props, ref) => {
return (
${processed}
)
}
})
`.trim() + "\n"
);
});
Expand Down

0 comments on commit 6348ad6

Please sign in to comment.