@@ -42,6 +42,14 @@ export interface CurvedLabelProps
42
42
textPathComponent ?: React . ReactElement ;
43
43
}
44
44
45
+ const defaultProps = {
46
+ tspanComponent : < TSpan /> ,
47
+ capHeight : 0.71 , // Magic number from d3.
48
+ lineHeight : 1 ,
49
+ textComponent : < Text /> ,
50
+ textPathComponent : < TextPath /> ,
51
+ } ;
52
+
45
53
const defaultStyles = VictoryLabel . defaultStyles ;
46
54
47
55
const getFontSize = ( style ) => {
@@ -171,7 +179,9 @@ const renderLabel = (calculatedProps, tspanValues) => {
171
179
style : currentStyle ,
172
180
children : line ,
173
181
} ;
174
- return React . cloneElement ( tspanComponent , tspanProps ) ;
182
+ if ( tspanComponent ) {
183
+ return React . cloneElement ( tspanComponent , tspanProps )
184
+ }
175
185
} ) ;
176
186
177
187
const textPathProps = {
@@ -190,14 +200,6 @@ const renderLabel = (calculatedProps, tspanValues) => {
190
200
return React . cloneElement ( textComponent , textProps , tspans ) ;
191
201
} ;
192
202
193
- const defaultProps = {
194
- tspanComponent : < TSpan /> ,
195
- capHeight : 0.71 , // Magic number from d3.
196
- lineHeight : 1 ,
197
- textComponent : < Text /> ,
198
- textPathComponent : < TextPath /> ,
199
- } ;
200
-
201
203
export const CurvedLabel : {
202
204
role : string ;
203
205
defaultStyles : typeof defaultStyles ;
0 commit comments