Skip to content

Commit 4b23323

Browse files
touch ups
1 parent 85fc835 commit 4b23323

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

demo/src/screens/componentScreens/SkeletonViewScreen.tsx

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,30 @@ export default class SkeletonViewScreen extends Component {
103103
);
104104
};
105105

106+
renderAvatar = () => {
107+
return (
108+
<ListItem.Part left>
109+
<Avatar
110+
source={this.getRandomAvatar()}
111+
containerStyle={{marginStart: 14}}
112+
/>
113+
</ListItem.Part>
114+
)
115+
}
116+
117+
renderThumbnail = () => {
118+
return (
119+
<ListItem.Part left>
120+
<Image
121+
source={this.getRandomAvatar()}
122+
style={{height: 54, width: 54, marginLeft: 14}}
123+
/>
124+
</ListItem.Part>
125+
)
126+
}
127+
106128
renderListItemsData = () => {
107-
const {listType} = this.state;
129+
const {listType, isLarge} = this.state;
108130
const hasAvatar = listType === LIST_TYPE.Avatar;
109131
const hasThumbnail = listType === LIST_TYPE.Thumbnail;
110132

@@ -115,35 +137,21 @@ export default class SkeletonViewScreen extends Component {
115137
<ListItem
116138
activeBackgroundColor={Colors.dark60}
117139
activeOpacity={0.3}
118-
height={77.5}
140+
height={90}
119141
onPress={() => Alert.alert(`pressed on order #${index + 1}`)}
120142
>
121-
{
122-
hasAvatar
123-
&& <ListItem.Part left>
124-
<Avatar
125-
source={this.getRandomAvatar()}
126-
containerStyle={{marginStart: 14}}
127-
/>
128-
</ListItem.Part>
129-
}
130-
{
131-
hasThumbnail
132-
&& <ListItem.Part left>
133-
<Image
134-
source={this.getRandomAvatar()}
135-
style={{height: 54, width: 54, marginLeft: 14}}
136-
/>
137-
</ListItem.Part>
138-
}
139-
143+
{hasAvatar && this.renderAvatar()}
144+
{hasThumbnail && this.renderThumbnail()}
140145
<ListItem.Part middle column containerStyle={[styles.border, {marginLeft: 18}]}>
141146
<ListItem.Part containerStyle={{marginBottom: 3}}>
142147
<Text text60 numberOfLines={1}>{`User ${index + 1}`}</Text>
143148
</ListItem.Part>
144149
<ListItem.Part>
145150
<Text text70 numberOfLines={1}>Member</Text>
146151
</ListItem.Part>
152+
{isLarge && <ListItem.Part>
153+
<Text text70 numberOfLines={1}>Since: </Text>
154+
</ListItem.Part>}
147155
</ListItem.Part>
148156
</ListItem>
149157
);
@@ -152,7 +160,7 @@ export default class SkeletonViewScreen extends Component {
152160
);
153161
};
154162

155-
renderListItems = (hasAvatar: boolean, hasThumbnail: boolean) => {
163+
renderListItems = (hasAvatar: boolean = false, hasThumbnail: boolean = false) => {
156164
const {isDataAvailable, isLarge} = this.state;
157165
const contentType = hasAvatar
158166
? SkeletonView.contentTypes.AVATAR

0 commit comments

Comments
 (0)