-
Notifications
You must be signed in to change notification settings - Fork 734
convert three digit hex to six #976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/style/colors.ts
Outdated
function threeDigitHexToSix(value: string) { | ||
return value.replace(/./g, '$&$&'); | ||
const firstDigit = value[0]; | ||
const secondDigit = value[1]; | ||
const thirdDigit = value[2]; | ||
return firstDigit.concat(firstDigit, secondDigit, secondDigit, thirdDigit, thirdDigit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just return value + value
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to double each letter:
threeDigitHexToSix(123)
should return 112233
and not 123123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are completely right! my bad :(
In that case the regex solution is definitely preferable...
apologies for the trouble
* master: Fix missed issue with migrating Picker API - PickerItem needs to retrieve the correct value format Add Slider testID (#999) Remove declaration of ref type on TouchableOpacity convert three digit hex to six (#976) Fix/text field right icon alignment (#997) migrate Switch to TS (#991) Move from KeyboardAwareListView to KeyboardAwareFlatList (#960) Update constants typings migrate ActionBar to TS (#987) Do not notify the user onPageChange for the fake page (fix autoscroll on Android bug) (#994) Add progress type for ProgressBarProps (#996) Fix generated JS files to include propTypes (#995) # Conflicts: # generatedTypes/components/touchableOpacity/index.d.ts
Description
Colors.rgba
returned wrong values when getting 3 digit hex,I've added function to convert 3 digit hex to 6 digit hex inside
validateHex
Bug description: #946
Changelog
fix bug in
Colors.rgba