我需要通过异步呼叫来获取用户配置文件头像,但我得到了一个错误。有人知道如何在react-native-element中做到这一点吗?
someAsyncToGetUserProfile = () => {
this.props.getUserAvatarUrl().then(doc =>
return doc.photoUrl
);
}
.
.
.
<ListItem
avatar={this.someAsyncToGetUserProfile}
/>发布于 2018-03-20 22:54:45
仅当函数声明为async时,才能使用Await。
someAsyncToGetUserProfile = async ()=>{
let doc = await this.props.getUserAvatarUrl();
return doc.photoUrl
}。。
<ListItem
avatar={this.someAsyncToGetUserProfile()}
/>https://stackoverflow.com/questions/49386672
复制相似问题