0

I'd like to store and RGB value using setState or something like that. InterpolateColor() currently returns a big number. Here's my repo: https://github.com/duether/react-native-color-picker

Enzo Barrera
  • 149
  • 1
  • 12

1 Answers1

0

This solution is for converting interpolated color to hex, I found the answer in this post https://stackoverflow.com/a/697841/14332782 so I did the following:

 const decimalToHexString = (number: any) => {
    if (number < 0) {
      number = 0xffffffff + number + 1;
    }
    setColor(number.toString(16).substring(2, 8));
  };

then run runOnJS(decimalToHexString)(interpolatedColor);

Beng88
  • 1
  • 1