talalmajali / react-native-countdown-component

React Native CountDown
MIT License
264 stars 233 forks source link

Maximum update depth exceeded #100

Open Bayramito opened 3 years ago

Bayramito commented 3 years ago

Hello,

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

Ekran Resmi 2021-06-01 10 38 02

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() / 1000);

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",
tearjuIce commented 3 years ago

hello, im facing this problem too. did u find a solution for it?

glennperez commented 1 year ago

Same problem :(

pedrogoiania commented 2 months ago

I solved that putting a value on Id prop