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
Asked
Active
Viewed 372 times
0
-
Were you able to find a way? – purewatashi21 Aug 08 '22 at 14:17
-
@purewatashi21 unfortunately.. no :( – Enzo Barrera Aug 16 '22 at 18:50
1 Answers
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