您好我正在尝试加载远程图像。onLoadStart 正在击中,但没有击中 onLoadEnd `
<View style={{ paddingTop: 60, paddingBottom: 10 }}>
{this.state.loading ? (
<DotIndicator size={25} color={"white"} />
) : (
<Image
resizeMode={this.resizeMode}
style={[styles.imageStyle, this.tintStyle]}
onLoadStart={e => {
this.setState({ loading: true });
}}
onLoadEnd={e => this.setState({ loading: false })}
// defaultSource={NoProfile}
// loadingIndicatorSource={require("@images/profile_placeholder.png")}
source={this.userImageUri}
onError={error => {
this.tintStyle = { tintColor: "lightgray" };
this.resizeMode = "contain";
this.userImageUri = NoProfile;
}}
/>
)}
</View>
Run Code Online (Sandbox Code Playgroud)
`
编辑 1
onLoadStart被命中。onLoad也永远不会被调用
有人有线索吗。我是新来的反应。任何帮助表示赞赏。谢谢是提前
解决方案
由于 Vignesh 和 hong 提到图像永远不会存在,因此永远不会调用它的 on loadEnd。因此,我不是只加载图像或加载器,而是将加载器加载到图像之上。在这里发布它,因为它有时可能对某人有用。再次感谢 Vignesh …