react-native-number-ticker icon indicating copy to clipboard operation
react-native-number-ticker copied to clipboard

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

Open altany opened this issue 4 years ago • 0 comments

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

altany avatar Jul 07 '20 12:07 altany