@@ -2,7 +2,7 @@ import * as React from 'react';
22import { GestureResponderEvent , TouchableOpacity , View } from 'react-native' ;
33import { DeepPartial } from 'ts-essentials' ;
44
5- import { ControlSize , TextSize , useTheme } from '../../theme' ;
5+ import { useTheme } from '../../theme' ;
66import { mergeStyles , ReplaceReturnType } from '../../utils/mergeStyles' ;
77import { Avatar , AvatarProps } from '../Avatar' ;
88import { Icon } from '../Icon' ;
@@ -14,18 +14,6 @@ import {
1414} from './ListItem.styles' ;
1515
1616export interface ListItemProps {
17- /**
18- * Size of the list item.
19- * @default "medium"
20- */
21- size ?: ControlSize ;
22-
23- /**
24- * When true, list item will not be able to be pressed.
25- * @default false
26- */
27- isDisabled ?: boolean ;
28-
2917 /**
3018 * Title of the list item
3119 */
@@ -41,6 +29,12 @@ export interface ListItemProps {
4129 */
4230 avatarProps ?: AvatarProps ;
4331
32+ /**
33+ * When true, list item will not be able to be pressed.
34+ * @default false
35+ */
36+ isDisabled ?: boolean ;
37+
4438 /**
4539 * Icon replacing `Avatar` on the left hand-side
4640 */
@@ -75,46 +69,13 @@ export interface ListItemProps {
7569 testID ?: string ;
7670}
7771
78- const iconSize : {
79- [ size in ControlSize ] : number ;
80- } = {
81- large : 32 ,
82- medium : 24 ,
83- small : 16 ,
84- } ;
85-
86- const avatarSize : {
87- [ size in ControlSize ] : number ;
88- } = {
89- large : 40 ,
90- medium : 32 ,
91- small : 24 ,
92- } ;
93-
94- const titleSize : {
95- [ size in ControlSize ] : TextSize ;
96- } = {
97- large : 'large' ,
98- medium : 'medium' ,
99- small : 'small' ,
100- } ;
101-
102- const descriptionSize : {
103- [ size in ControlSize ] : TextSize ;
104- } = {
105- large : 'medium' ,
106- medium : 'small' ,
107- small : 'xsmall' ,
108- } ;
109-
11072export const ListItem = ( props : ListItemProps ) => {
11173 const {
11274 avatarProps,
11375 getStyles,
11476 isDisabled = false ,
11577 title,
11678 description,
117- size = 'medium' ,
11879 onPress,
11980 rightIcon,
12081 leftIcon,
@@ -153,23 +114,19 @@ export const ListItem = (props: ListItemProps) => {
153114 < View style = { leftWrapperStyle } >
154115 < View style = { imageWrapperStyle } >
155116 { leftIcon || avatarProps ? (
156- < Avatar size = { avatarSize [ size ] } { ...avatarProps } />
117+ < Avatar size = "small" { ...avatarProps } />
157118 ) : null }
158119 </ View >
159120 < View style = { textWrapperStyle } >
160121 { title && (
161- < Text
162- getStyles = { ( ) => ( { textStyle : titleStyle } ) }
163- size = { titleSize [ size ] }
164- weight = "500"
165- >
122+ < Text getStyles = { ( ) => ( { textStyle : titleStyle } ) } size = "large" >
166123 { title }
167124 </ Text >
168125 ) }
169126 { description && (
170127 < Text
171128 getStyles = { ( ) => ( { textStyle : descriptionStyle } ) }
172- size = { descriptionSize [ size ] }
129+ size = "medium"
173130 color = "muted"
174131 >
175132 { description }
@@ -180,11 +137,7 @@ export const ListItem = (props: ListItemProps) => {
180137 { rightIcon === null
181138 ? null
182139 : rightIcon || (
183- < Icon
184- color = "default"
185- size = { iconSize [ size ] }
186- name = "chevron-right"
187- />
140+ < Icon color = "default" size = { 24 } name = "chevron-right" />
188141 ) }
189142 </ View >
190143 </ TouchableOpacity >
0 commit comments