@@ -67,12 +67,6 @@ export interface SkeletonViewProps extends AccessibilityProps, AlignmentModifier
67
67
* Custom value of any type to pass on to SkeletonView and receive back in the renderContent callback.
68
68
*/
69
69
customValue ?: any ;
70
- /**
71
- * @deprecated
72
- * - Please use customValue instead.
73
- * - Custom value of any type to pass on to SkeletonView and receive back in the renderContent callback.
74
- */
75
- contentData ?: any ;
76
70
/**
77
71
* The type of the skeleton view.
78
72
* Types: LIST_ITEM and TEXT_CONTENT (using SkeletonView.templates.###)
@@ -94,32 +88,6 @@ export interface SkeletonViewProps extends AccessibilityProps, AlignmentModifier
94
88
* This is needed because the `key` prop is not accessible.
95
89
*/
96
90
timesKey ?: string ;
97
- /**
98
- * @deprecated
99
- * - Pass via listProps instead.
100
- * - The size of the skeleton view.
101
- * - Types: SMALL and LARGE (using SkeletonView.sizes.###)
102
- */
103
- size ?: Size ;
104
- /**
105
- * @deprecated
106
- * - Pass via listProps instead.
107
- * - Add content to the skeleton.
108
- * - Types: AVATAR and THUMBNAIL (using SkeletonView.contentTypes.###)
109
- */
110
- contentType ?: ContentType ;
111
- /**
112
- * @deprecated
113
- * - Pass via listProps instead.
114
- * - Whether to hide the list item template separator
115
- */
116
- hideSeparator ?: boolean ;
117
- /**
118
- * @deprecated
119
- * - Pass via listProps instead.
120
- * - Whether to show the last list item template separator
121
- */
122
- showLastSeparator ?: boolean ;
123
91
/**
124
92
* The height of the skeleton view
125
93
*/
@@ -266,41 +234,22 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
266
234
} ;
267
235
} ;
268
236
269
- get size ( ) {
270
- const { listProps, size} = this . props ;
271
- return listProps ?. size || size ;
272
- }
273
-
274
237
get contentSize ( ) {
275
- return this . size === Size . LARGE ? 48 : 40 ;
276
- }
277
-
278
- get contentType ( ) {
279
- const { listProps, contentType} = this . props ;
280
- return listProps ?. contentType || contentType ;
281
- }
282
-
283
- get hideSeparator ( ) {
284
- const { listProps, hideSeparator} = this . props ;
285
- return listProps ?. hideSeparator || hideSeparator ;
286
- }
287
-
288
- get showLastSeparator ( ) {
289
- const { listProps, showLastSeparator} = this . props ;
290
- return listProps ?. showLastSeparator || showLastSeparator ;
238
+ const { listProps} = this . props ;
239
+ return listProps ?. size === Size . LARGE ? 48 : 40 ;
291
240
}
292
241
293
242
renderListItemLeftContent = ( ) => {
294
- const contentType = this . contentType ;
243
+ const { listProps} = this . props ;
244
+ const contentType = listProps ?. contentType ;
295
245
if ( contentType ) {
296
- const contentSize = this . contentSize ;
297
246
const circleOverride = contentType === ContentType . AVATAR ;
298
- const style = { marginRight : this . size === Size . LARGE ? 16 : 14 } ;
247
+ const style = { marginRight : listProps ? .size === Size . LARGE ? 16 : 14 } ;
299
248
return (
300
249
< ShimmerPlaceholder
301
250
{ ...this . getDefaultSkeletonProps ( { circleOverride, style} ) }
302
- width = { contentSize }
303
- height = { contentSize }
251
+ width = { this . contentSize }
252
+ height = { this . contentSize }
304
253
/>
305
254
) ;
306
255
}
@@ -319,15 +268,13 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
319
268
320
269
renderListItemContentStrips = ( ) => {
321
270
const { listProps} = this . props ;
322
- const contentType = this . contentType ;
323
- const size = this . size ;
324
- const hideSeparator = this . hideSeparator ;
325
- const customLengths = contentType === ContentType . AVATAR ? [ undefined , 50 ] : undefined ;
271
+ const size = listProps ?. size ;
272
+ const customLengths = listProps ?. contentType === ContentType . AVATAR ? [ undefined , 50 ] : undefined ;
326
273
const height = size === Size . LARGE ? 95 : 75 ;
327
274
const lengths = _ . merge ( [ 90 , 180 , 160 ] , customLengths ) ;
328
275
const topMargins = [ 0 , size === Size . LARGE ? 16 : 8 , 8 ] ;
329
276
return (
330
- < View flex height = { height } centerV style = { ! hideSeparator && Dividers . d10 } row >
277
+ < View flex height = { height } centerV style = { ! listProps ?. hideSeparator && Dividers . d10 } row >
331
278
< View >
332
279
{ this . renderStrip ( true , lengths [ 0 ] , topMargins [ 0 ] ) }
333
280
{ this . renderStrip ( false , lengths [ 1 ] , topMargins [ 1 ] ) }
@@ -391,7 +338,7 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
391
338
392
339
renderWithFading = ( skeleton : any ) => {
393
340
const { isAnimating} = this . state ;
394
- const { children, renderContent, customValue, contentData } = this . props ;
341
+ const { children, renderContent, customValue} = this . props ;
395
342
396
343
if ( isAnimating ) {
397
344
return (
@@ -405,8 +352,7 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
405
352
</ Animated . View >
406
353
) ;
407
354
} else if ( _ . isFunction ( renderContent ) ) {
408
- const _customValue = customValue || contentData ;
409
- return renderContent ( _customValue ) ;
355
+ return renderContent ( customValue ) ;
410
356
} else {
411
357
return children ;
412
358
}
@@ -441,13 +387,8 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
441
387
renderContent,
442
388
showContent,
443
389
customValue,
444
- contentData,
445
390
template,
446
391
listProps,
447
- size,
448
- contentType,
449
- hideSeparator,
450
- showLastSeparator,
451
392
height,
452
393
width,
453
394
colors,
@@ -462,13 +403,8 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
462
403
showContent,
463
404
renderContent,
464
405
customValue,
465
- contentData,
466
406
template,
467
407
listProps,
468
- size,
469
- contentType,
470
- hideSeparator,
471
- showLastSeparator,
472
408
height,
473
409
width,
474
410
colors,
@@ -483,13 +419,17 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
483
419
< View { ...others } >
484
420
{ _ . times ( times , index => {
485
421
const key = timesKey ? `${ timesKey } -${ index } ` : `${ index } ` ;
422
+ const _listProps = {
423
+ ...listProps ,
424
+ hideSeparator : listProps ?. hideSeparator || ( ! listProps ?. showLastSeparator && index === times - 1 )
425
+ } ;
486
426
return (
487
427
< SkeletonView
488
428
{ ...passedProps }
429
+ listProps = { _listProps }
489
430
key = { key }
490
431
testID = { `${ testID } -${ index } ` }
491
432
renderContent = { index === 0 ? renderContent : this . renderNothing }
492
- hideSeparator = { this . hideSeparator || ( ! this . showLastSeparator && index === times - 1 ) }
493
433
times = { undefined }
494
434
/>
495
435
) ;
0 commit comments