on master help sign in
Add key prop to ReactSVGComponents
commit773931c8c9c029310c30d2dcc04219e80bfd3454 authorpkova <pyry.kovanen@gmail.com> dateWed 17 Apr 2019, 00:00 (8 years ago) parent58b8e51
1 file changed+24−24
src/bridge/components/ReactSVGComponents.js+24−24
src/bridge/components/ReactSVGComponents.js+24−24
@@ -2,59 +2,59 @@ import React from 'react'
22import { get, map } from 'lodash'
33
44const ReactSVGComponents = {
5− svg: p => {
5+ svg: (p, key) => {
66 return (
7− <svg {...p.attr} version={'1.1'} xmlns={'http://www.w3.org/2000/svg'}>
8− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
7+ <svg {...p.attr} version={'1.1'} xmlns={'http://www.w3.org/2000/svg'} key={key}>
8+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
99 </svg>
1010 )
1111 },
12− circle: p => {
12+ circle: (p, key) => {
1313 return (
14− <circle {...p.attr}>
15− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
14+ <circle {...p.attr} key={key}>
15+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
1616 </circle>
1717 )
1818 },
19− rect: p => {
19+ rect: (p, key) => {
2020 return (
21− <rect {...p.attr}>
22− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
21+ <rect {...p.attr} key={key}>
22+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
2323 </rect>
2424 )
2525 },
26− path: p => {
26+ path: (p, key) => {
2727 return (
28− <path {...p.attr}>
29− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
28+ <path {...p.attr} key={key}>
29+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
3030 </path>
3131 )
3232 },
33− g: p => {
33+ g: (p, key) => {
3434 return (
35− <g {...p.attr}>
36− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
35+ <g {...p.attr} key={key}>
36+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
3737 </g>
3838 )
3939 },
40− polygon: p => {
40+ polygon: (p, key) => {
4141 return (
42− <polygon {...p.attr}>
43− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
42+ <polygon {...p.attr} key={key}>
43+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
4444 </polygon>
4545 )
4646 },
47− line: p => {
47+ line: (p, key) => {
4848 return (
49− <line {...p.attr}>
50− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
49+ <line {...p.attr} key={key}>
50+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
5151 </line>
5252 )
5353 },
54− polyline: p => {
54+ polyline: (p, key) => {
5555 return (
56− <polyline {...p.attr}>
57− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
56+ <polyline {...p.attr} key={key}>
57+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
5858 </polyline>
5959 )
6060 }