Skip to content

Commit 6d7a683

Browse files
committed
LFG-187: image placeholder shown while loading the image
1 parent 99c50df commit 6d7a683

File tree

4 files changed

+27
-35
lines changed

4 files changed

+27
-35
lines changed

app/screens/contact/contactCell/contactCell.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,27 @@ import placeHolderImage from './../../../../assets/images/default.png';
8989
)
9090
}
9191

92+
_imageLoadComplete = () => {
93+
// console.log('=====00000')
94+
}
95+
9296
render() {
9397
return (
9498
<TouchableHighlight onPress={() => this._onCellSelection()} underlayColor={colors.LIGHT_GRAY} activeOpacity={0.4}>
9599
<View style={ style.mainContainer }>
96100
<View style={style.imageContainer}>
101+
<EmptyProfileImage
102+
firstName={this.props.data.firstName}
103+
lastName={this.props.data.lastName}
104+
textSize={16}
105+
style={style.contactImage}
106+
/>
97107
{
98-
this.props.data.avatarUrl ?
99-
<Image style={[style.contactImage, {resizeMode: 'contain'}]} source={{uri: this.props.data.avatarUrl}}/>
100-
// <ProgressiveImage source={{uri: this.props.avatarUrl}} thumbnail={placeHolderImage} style={style.contactImage} />
101-
:
102-
<EmptyProfileImage
103-
firstName={this.props.data.firstName}
104-
lastName={this.props.data.lastName}
105-
textSize={16}
106-
style={style.placeHolder}
108+
this.props.data.avatarUrl &&
109+
<Image
110+
style={[style.contactImage, {resizeMode: 'contain', position: 'absolute', zIndex: 10}]}
111+
source={{uri: this.props.data.avatarUrl}}
112+
onLoad={() => this._imageLoadComplete()}
107113
/>
108114
}
109115
</View>

app/screens/contact/contactCell/styles.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const style = StyleSheet.create({
1919
// backgroundColor: 'red',
2020
},
2121
contactImage: {
22-
width: 60,
23-
height: 60,
22+
width: AVATAR_SIZE,
23+
height: AVATAR_SIZE,
2424
borderWidth: 1,
25-
borderRadius: 30,
25+
borderRadius: AVATAR_SIZE / 2,
2626
// shadowRadius: 5,
2727
// shadowColor: 'black',
2828
// shadowOpacity: 0.6,
@@ -110,19 +110,7 @@ const style = StyleSheet.create({
110110
zIndex: 10,
111111
backgroundColor: colors.LIGHT_GRAY,
112112
},
113-
placeHolder: {
114-
marginBottom: 5,
115-
width: AVATAR_SIZE,
116-
height: AVATAR_SIZE,
117-
borderRadius: AVATAR_SIZE / 2,
118-
borderWidth: 1,
119-
borderRadius: AVATAR_SIZE / 2,
120-
// shadowRadius: 5,
121-
// shadowColor: 'black',
122-
// shadowOpacity: 0.6,
123-
borderColor: colors.LIGHT_GRAY,
124-
// shadowOffset: { width: 0, height: 0 }
125-
},
113+
126114
});
127115

128116
export default style;

app/screens/profile/profile.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,14 @@ class ProfileScreen extends Component {
145145
</View>
146146
}
147147
<View style={ style.photoContainer }>
148+
<EmptyProfileImage
149+
firstName={this.data.firstName}
150+
lastName={this.data.lastName}
151+
textSize={38}
152+
style={style.avatar}
153+
/>
148154
{
149-
this.data.avatarUrl ?
150-
<Image style={[style.avatar, {resizeMode: 'contain'}]} source={{uri: this.data.avatarUrl}}/>
151-
:
152-
<EmptyProfileImage
153-
firstName={this.data.firstName}
154-
lastName={this.data.lastName}
155-
textSize={38}
156-
style={style.placeHolder}
157-
/>
155+
<Image style={[style.avatar, {resizeMode: 'contain', position: 'absolute', top: 64}]} source={{uri: this.data.avatarUrl}}/>
158156
}
159157
</View>
160158
{ !this.props.data.fromProfileTab &&

app/screens/profile/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const style = StyleSheet.create({
8080
flexDirection: 'column',
8181
},
8282
avatar: {
83-
marginBottom: 5,
83+
marginBottom: 4,
8484
width: AVATAR_SIZE,
8585
height: AVATAR_SIZE,
8686
borderRadius: AVATAR_SIZE / 2,

0 commit comments

Comments
 (0)