@@ -90,27 +90,22 @@ export default SvgComponent;"
9090exports[`plugin javascript with "ref" and "expandProps" option expands props 1`] = `
9191"import * as React from \\"react\\";
9292
93- function SvgComponent({
94- svgRef ,
95- ... props
96- } ) {
93+ function SvgComponent(props, svgRef) {
9794 return <svg ><g /></svg >;
9895}
9996
100- const ForwardRef = React.forwardRef((props, ref) => < SvgComponent svgRef = { ref } { ... props } /> );
97+ const ForwardRef = React.forwardRef(SvgComponent);
10198export default ForwardRef;"
10299`;
103100
104101exports[`plugin javascript with "ref" option adds ForwardRef component 1`] = `
105102"import * as React from \\"react\\";
106103
107- function SvgComponent({
108- svgRef
109- } ) {
104+ function SvgComponent(props, svgRef) {
110105 return <svg ><g /></svg >;
111106}
112107
113- const ForwardRef = React.forwardRef((props, ref) => < SvgComponent svgRef = { ref } { ... props } /> );
108+ const ForwardRef = React.forwardRef(SvgComponent);
114109export default ForwardRef;"
115110`;
116111
@@ -127,18 +122,30 @@ function SvgComponent({
127122export default SvgComponent;"
128123`;
129124
130- exports[`plugin javascript with both "memo " and "ref" option wrap component in "React.memo" and "React.forwardRef" 1`] = `
125+ exports[`plugin javascript with "titleProp " and "expandProps" adds "titleProp", "titleId" props and expands props 1`] = `
131126"import * as React from \\"react\\";
132127
133128function SvgComponent({
134- svgRef
129+ title ,
130+ titleId ,
131+ ... props
135132} ) {
136133 return <svg ><g /></svg >;
137134}
138135
139- const MemoSvgComponent = React.memo(SvgComponent);
140- const ForwardRef = React.forwardRef((props, ref) => <MemoSvgComponent svgRef = { ref } { ... props } />);
141- export default ForwardRef;"
136+ export default SvgComponent;"
137+ `;
138+
139+ exports[`plugin javascript with both "memo" and "ref" option wrap component in "React.memo" and "React.forwardRef" 1`] = `
140+ "import * as React from \\"react\\";
141+
142+ function SvgComponent(props, svgRef) {
143+ return <svg ><g /></svg >;
144+ }
145+
146+ const ForwardRef = React.forwardRef(SvgComponent);
147+ const MemoForwardRef = React.memo(ForwardRef);
148+ export default MemoForwardRef;"
142149`;
143150
144151exports[`plugin typescript custom templates support basic template 1`] = `
@@ -214,34 +221,23 @@ export default SvgComponent;"
214221
215222exports[`plugin typescript with "ref" and "expandProps" option expands props 1`] = `
216223"import * as React from \\"react\\";
217- interface SVGRProps {
218- svgRef ?: React .Ref <SVGSVGElement >
219- }
220224
221- function SvgComponent({
222- svgRef ,
223- ... props
224- } : React.SVGProps<SVGSVGElement > & SVGRProps) {
225+ function SvgComponent(props: React.SVGProps<SVGSVGElement >, svgRef?: React.Ref<SVGSVGElement >) {
225226 return <svg ><g /></svg >;
226227}
227228
228- const ForwardRef = React.forwardRef((props, ref: React.Ref< SVGSVGElement >) => < SvgComponent svgRef = { ref } { ... props } /> );
229+ const ForwardRef = React.forwardRef(SvgComponent);
229230export default ForwardRef;"
230231`;
231232
232233exports[`plugin typescript with "ref" option adds ForwardRef component 1`] = `
233234"import * as React from \\"react\\";
234- interface SVGRProps {
235- svgRef ?: React .Ref <SVGSVGElement >
236- }
237235
238- function SvgComponent({
239- svgRef
240- } : SVGRProps) {
236+ function SvgComponent(props: { } , svgRef?: React.Ref<SVGSVGElement >) {
241237 return <svg ><g /></svg >;
242238}
243239
244- const ForwardRef = React.forwardRef((props, ref: React.Ref< SVGSVGElement >) => < SvgComponent svgRef = { ref } { ... props } /> );
240+ const ForwardRef = React.forwardRef(SvgComponent);
245241export default ForwardRef;"
246242`;
247243
@@ -262,19 +258,32 @@ function SvgComponent({
262258export default SvgComponent;"
263259`;
264260
265- exports[`plugin typescript with both "memo " and "ref" option wrap component in "React.memo" and "React.forwardRef" 1`] = `
261+ exports[`plugin typescript with "titleProp " and "expandProps" adds "titleProp", "titleId" props and expands props 1`] = `
266262"import * as React from \\"react\\";
267263interface SVGRProps {
268- svgRef ?: React .Ref <SVGSVGElement >
264+ title ?: string ,
265+ titleId ?: string ,
269266}
270267
271268function SvgComponent({
272- svgRef
273- } : SVGRProps) {
269+ title ,
270+ titleId ,
271+ ... props
272+ } : React.SVGProps<SVGSVGElement > & SVGRProps) {
274273 return <svg ><g /></svg >;
275274}
276275
277- const MemoSvgComponent = React.memo(SvgComponent);
278- const ForwardRef = React.forwardRef((props, ref: React.Ref<SVGSVGElement >) => <MemoSvgComponent svgRef = { ref } { ... props } />);
279- export default ForwardRef;"
276+ export default SvgComponent;"
277+ `;
278+
279+ exports[`plugin typescript with both "memo" and "ref" option wrap component in "React.memo" and "React.forwardRef" 1`] = `
280+ "import * as React from \\"react\\";
281+
282+ function SvgComponent(props: { } , svgRef?: React.Ref<SVGSVGElement >) {
283+ return <svg ><g /></svg >;
284+ }
285+
286+ const ForwardRef = React.forwardRef(SvgComponent);
287+ const MemoForwardRef = React.memo(ForwardRef);
288+ export default MemoForwardRef;"
280289`;
0 commit comments