on master help sign in
Merge pull request #82 from pkova/key-prop-fix
7c3b12bFang
src/bridge/components/ReactSVGComponents.js+24−24
@@ -2,59 +2,59 @@ import React from 'react'
2import { get, map } from 'lodash'
2import { get, map } from 'lodash'
3
3
4const ReactSVGComponents = {
4const ReactSVGComponents = {
5− svg: p => {
5+ svg: (p, key) => {
6 return (
6 return (
7− <svg {...p.attr} version={'1.1'} xmlns={'http://www.w3.org/2000/svg'}>
7+ <svg {...p.attr} version={'1.1'} xmlns={'http://www.w3.org/2000/svg'} key={key}>
8− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
8+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
9 </svg>
9 </svg>
10 )
10 )
11 },
11 },
12− circle: p => {
12+ circle: (p, key) => {
13 return (
13 return (
14− <circle {...p.attr}>
14+ <circle {...p.attr} key={key}>
15− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
15+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
16 </circle>
16 </circle>
17 )
17 )
18 },
18 },
19− rect: p => {
19+ rect: (p, key) => {
20 return (
20 return (
21− <rect {...p.attr}>
21+ <rect {...p.attr} key={key}>
22− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
22+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
23 </rect>
23 </rect>
24 )
24 )
25 },
25 },
26− path: p => {
26+ path: (p, key) => {
27 return (
27 return (
28− <path {...p.attr}>
28+ <path {...p.attr} key={key}>
29− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
29+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
30 </path>
30 </path>
31 )
31 )
32 },
32 },
33− g: p => {
33+ g: (p, key) => {
34 return (
34 return (
35− <g {...p.attr}>
35+ <g {...p.attr} key={key}>
36− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
36+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
37 </g>
37 </g>
38 )
38 )
39 },
39 },
40− polygon: p => {
40+ polygon: (p, key) => {
41 return (
41 return (
42− <polygon {...p.attr}>
42+ <polygon {...p.attr} key={key}>
43− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
43+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
44 </polygon>
44 </polygon>
45 )
45 )
46 },
46 },
47− line: p => {
47+ line: (p, key) => {
48 return (
48 return (
49− <line {...p.attr}>
49+ <line {...p.attr} key={key}>
50− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
50+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
51 </line>
51 </line>
52 )
52 )
53 },
53 },
54− polyline: p => {
54+ polyline: (p, key) => {
55 return (
55 return (
56− <polyline {...p.attr}>
56+ <polyline {...p.attr} key={key}>
57− { map(get(p, 'children', []), child => ReactSVGComponents[child.tag](child)) }
57+ { map(get(p, 'children', []), (child, idx) => ReactSVGComponents[child.tag](child, idx)) }
58 </polyline>
58 </polyline>
59 )
59 )
60 }
60 }