RobertFOConnor / react-native-number-ticker

A simple easy-to-use ticker component for animating ticker numbers.
29 stars 15 forks source link

Fix unique key issue when number has multiple of the same digit. #10

Open altany opened 4 years ago

altany commented 4 years ago

As reported here: https://github.com/RobertFOConnor/react-native-number-ticker/issues/1#issuecomment-654753430

Hi @RobertFOConnor. This is still an issue in the latest version when there are two same digits in the number prop. I recommend you amend the index of the .map() to the data as a key, to ensure it will always be unique.

return (number + '').split('').map((data, index) => {
    <TextTicker
        key={`${data}${index}`}
        ...
    />
})

See screenshot when value is 199 image