【发布时间】:2021-07-13 05:27:59
【问题描述】:
我正在使用带有 Firestore 的 React-Native。我运行一个函数来更新 firestore 数据库,但它并不总是更新。有时我必须按两次按钮。
const markAsCompleted = async (id, isCompleted) => {
console.log(id);
await todoRef
.doc(id)
.update({
isComplete: isCompleted,
})
.then(() => {
console.log("mark As Completed Updated!");
});
};
render(){
return(
<View>
<Button onPress={()=> this.markAsCompleted('123', true)}
</View>
)
}
【问题讨论】:
标签: react-native google-cloud-firestore