Avatar source null no title initials back
See original GitHub issueversion 1.1.0
Explain what you did Hi I have a component which display my profile image from Firebase. If I have no image the initial was displayed. I have some interaction to delete the remote image or change the image. When I hit the delete button my avatar remove the image but it is empty. The initials title are not going back.
Expected behaviour I search a way to force back the initials if the source is set to undefined or null. I was thinking this is what it must happen.
My props are well passed to my child component and updated.
this is how I cal my child component :
<ProfileImage profile={this.props.profile} backgroundColor={theme.SECONDARY_COLOR} deletefunction={this.deleteImage} modifyfunction={this.pickImage} imgSource={this.state.imgSource} flexDirection={'row'} size={'large'} showEditButton={this.state.editMode} />
Here in my child component how I use ternary to set to undefined if no image are loaded. I use an alternative state to store the image before saving to firebase on save button press.
source={imgSource ? { uri: imgSource.uri } : profile.profileImg ? { uri: profile.profileImg } : undefined}
If I reload my app the title initials are back as intended.
Screenshots Before set an image

after set an image

when image is deleted

Your Environment (please complete the following information):
| software | version |
|---|---|
| react-native-elements | 1.1.0 |
| react-native | 0.59.3 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:5

Top Related StackOverflow Question
The fix for this was made on the
nextbranch so it isn’t released on npm as yet. If you want to use this version at the moment you can do:Great thanks again
Cchumi