talalmajali / react-native-countdown-component

React Native CountDown
MIT License
264 stars 233 forks source link

Maximum update depth exceeded. #99

Closed Bayramito closed 3 years ago

Bayramito commented 3 years ago

Hello,

Im getting this error below when i use the Countdown component inside a FlatList item.

I calculate the time until time like below.

  const date = parseInt(new Date(props.item.finished_date).getTime() / 1000);
  const today = parseInt(new Date().getTime() / 100 0);

And here is my Component.

NOTE: this is a renderItem component for the FlatList

      <CountDown
        style={{
          position: "absolute",
          top: 0,
          zIndex: 999,
          backgroundColor: colorsComponent.backgroundColorGreen,
          alignSelf: "center",
          borderBottomLeftRadius: 5,
          borderBottomRightRadius: 5,
        }}
        until={date - today}
        size={15}
        onFinish={() => {}}
        digitStyle={{height: 20}}
        digitTxtStyle={{color: "#fff"}}
        timeLabelStyle={{...textStyles().boldWhite, ...textStyles().fontSize10}}
        timeToShow={["H", "M", "S"]}
        timeLabels={{h: "Sa", m: "Dk", s: "Sn"}}
      />

Env.

   "react-native": "0.63.4",
    "react-native-countdown-component": "^2.7.1",
shmagdy commented 2 years ago

Hello @Bayramito, Did you find a solution to this issue?