先完成要在recyclerView上删除的滑动动画,然后再在Frestore上删除

时间:2018-12-17 08:07:20

标签: android firebase android-recyclerview google-cloud-firestore

我已在要回收的设备上滑动以删除,并且适配器的deleteItem上有以下代码:

 public void deleteItem(int position) {
    moveFirestoreDocument(from, movedTo);
    notifyItemRemoved(position);
}

代码有效,但是速度很慢。滑动时,recyclerView将等待Firestore的条目从列表中消失,然后读取栏(onSwipe)消失。

我计划在以后合并撤消功能,但是现在,如何使Recycler视图平稳运行而不必等待Firestore删除?

1 个答案:

答案 0 :(得分:0)

尝试这个

const MyComponent = ({ title, data }: Props) => {
  function setPercentageColor() {
    console.log("standard");
    return "#ca2626";
  }
  const percentage = "50";
  return (
    <div className="progress-circle">
      <CircularProgressbar
        percentage={percentage}
        text={percentage}
        styles={{
          root: {},
          path: {
            stroke: "#0080a6",
            strokeWidth: "8",
            transition: "stroke-dashoffset 0.5s ease 0s"
          },
          trail: {
            stroke: setPercentageColor //here I want to access
          },
          text: {
            fill: "#28323c",
            fontSize: "35px",
            fontFamily: "Roboto Regular"
          }
        }}
      />
    </div>
  );
};
export default MyComponent;