Avatar Background Image Flashing Grey
See original GitHub issueIssue- when I type into handle change basically every time it re-renders the overlayContainerStyle every time. I am able to switch to just image and it will never re-render, but I would like to use the avatar and edit badge. I included a video attachment with what is going on
Versions:
“react-native-elements”: “^1.2.0”, “react-native”: “0.60.5”,
Video of issue:
https://vimeo.com/user105102986/review/372705871/7aa951b3a3
Code:
WHERE THE ISSUES IS:
<Avatar
size="xlarge"
rounded
source={{ uri: this.state.profilePicture }}
showEditButton
/>
Full code
import React, { Component } from "react";
import { connect } from "react-redux";
import {
updateProfilePhoto,
updateUserInformation,
loadCurrentUserProfile
} from "../../../store/profile/actions";
import { loadCurrentUser } from "../../../store/chat/actions";
import {
Text,
TextInput,
View,
SafeAreaView,
ScrollView,
ActivityIndicator,
} from "react-native";
import { Avatar } from "react-native-elements";
import styles from "./Styles";
class EditProfileComponent extends Component {
constructor(props) {
super(props);
this.state = {
description: this.props.currentUser.about,
profilePicture: this.props.currentUser.profilePicture,
};
this.handleDescriptionChange = description => {
this.setState({ description });
};
}
componentDidMount() {
this.props.updateProfilePhoto;
this.props.updateUserInformation;
this.props.loadCurrentUser;
}
componentDidUpdate(prevProps) {
if (this.props.photoUrl && prevProps.photoUrl !== this.props.photoUrl) {
this.setState({ profilePicture: this.props.photoUrl });
}
}
render() {
const { username, loadingProfilePicture } = this.props;
const {
header,
flex1,
safeAreaView,
label,
descriptionContainer,
descriptionText,
characterCount,
} = styles;
return (
<SafeAreaView style={safeAreaView}>
<View style={flex1}>
<ScrollView style={flex1}>
<View style={header}>
{!loadingProfilePicture ? (
<Avatar
size="xlarge"
rounded
source={{ uri: this.state.profilePicture }}
showEditButton
/>
) : (
<ActivityIndicator />
)}
<Text style={styles.username}>{username}</Text>
</View>
<View style={flex1}>
<Text style={label}>ABOUT ME:</Text>
<View style={descriptionContainer}>
<TextInput
multiline={true}
numberOfLines={10}
onChangeText={this.handleDescriptionChange}
value={this.state.description}
placeholder="Tell everyone about your riding style,
favorite mountains, what makes you unique, etc.."
editable={true}
maxLength={300}
style={descriptionText}
/>
</View>
{this.state.description ? (
<Text style={characterCount}>
Characters Count: {this.state.description.length}/300
</Text>
) : null}
</View>
</ScrollView>
</View>
</SafeAreaView>
);
}
}
const mapStateToProps = state => ({
loadingProfilePicture: state.profile.loadingProfilePicture,
loadingProfileDescription: state.profile.loadingProfileDescription,
currentUser: state.chat.currentUser,
loading: state.chat.loadCurrentUser,
photoUrl: state.profile.photoUrl,
interests: state.profile.interests,
currentUserProfile: state.profile.currentUserProfile
});
const mapDispatchToProps = {
updateProfilePhoto,
updateUserInformation,
loadCurrentUser,
loadCurrentUserProfile
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(EditProfileComponent);
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Background keeps flashing while in game?! : r/Vive - Reddit
Background flickering is caused by either dropped frames or loss of tracking quality. I'd imagine most of your problems are caused by loosing...
Read more >Why is my background image disappearing/flickering ...
The image will flicker in and out a bit before permanently being replaced with the gray background. Here is my HTML:
Read more >500+ Flash Images | Download Free Pictures on Unsplash
Download the perfect flash pictures. Find over 100+ of the best free flash images. ... Unsplash logo. Avatar of user Getty Images.
Read more >macos - Sudden flash of gray in the background - Ask Different
In the last few days I've had a sudden flash of gray in the background. I'm on MacOS 10.7.5. I'm not able to...
Read more >The Complete Guide to Lazy Loading Images | CSS-Tricks
In short, a gray placeholder box is rendered on the page until it scrolls into view—at ... Chapter 4: Lazy Loading CSS Background...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Avatar already supports this by use of the
imagePropspropThere’s an option to disable the animation, that will come in the next release https://github.com/react-native-elements/react-native-elements/commit/4a19e4c7a9d8f0a219c75b49d3fae2252bcd9bdb#diff-db91516ae3fd33db904a11400a5e19e4