The issue has been closed
In Simple Words: It gives error 'No identifiers allowed directly after numeric literal' when use Lighten in React Native, have a look below:
import Color from "color";
const lighterColor = Color(color).lighten(0.8) //Here we have Title Error!

Please show the actual error.
posted by Qix- over 3 years ago
Getting the following error:
./node_modules/color/index.js 246:28
Module parse failed: Identifier directly after number (246:28)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| for (const [i, element] of rgb.entries()) {
| const chan = element / 255;
> lum[i] = chan <= 0.039_28 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
| }
|
when i just import and construct new object:
import Color from 'color';
export function isDark(color: string): boolean {
const clr = Color(color);
return clr.isDark();
}
in a new create-react-app
project.
I'm getting that error with @4.0.0
and @4.0.1
, but it's working at @^3.2.1
.
My @types/color
version is @^3.0.2
posted by Gabrielhvcardoso over 3 years ago
posted by Qix- over 3 years ago 
As i've said, this problem affect a ReactJS app, I can't just import the color package in a project file because it throws that error event even if a do not create an instance of it.
Well, I'm going to stay using the version ^3.0.2
which works well, but keep it on your radar. Thank you.
posted by Gabrielhvcardoso over 3 years ago
but keep it on your radar
There's nothing to keep on my radar. Staying on v3 is the appropriate action if your tools/environment do not support modern javascript.
posted by Qix- over 3 years ago