Closed eyu0415 closed 4 years ago
If I pass sassOptions
sassOptions: {
functions: {
'rgba($r, $g, $b, $a)': (r, g, b, a) => {
const hexR = r.getValue().toString(16);
const hexG = g.getValue().toString(16);
const hexB = b.getValue().toString(16);
const hexA = Math.round(255 * a.getValue()).toString(16);
const hexColor = new sass.types.String(#${hexR}${hexG}${hexB}${hexA}
);
return hexColor;
},
},
}
It works because pre convert to hex string,
But converted by sass.types.Color with opacity throw parse error.
even pre convert sass.types.String(rgba(r, g, b, a)
);
Thanks @eyu0415. This is a bug in the CSS parser. I will work on a fix.
This is fixed in css-to-react-native
version 2.3.2
To get the fix, you can uninstall and reinstall react-native-sass-transformer
to update the depenencies from your npm or yarn lock file.
rgba(#fff, 0.1) or rgba(255, 255, 255, 0.1) Failed parse declaration ex { borderColor }
But hex color with alpha channel works fine. (#ffffff19)