Error: defaultIcon is read-only
Closed this issue ยท 8 comments
Hi there! I'm finding react-native-checkbox-heaven is causing my test builds to error out because of a line in CheckBox.js where a constant, defaultIcon
, is reassigned. This doesn't seem to affect the app as it runs in the emulator, but it does make it impossible to run my tests, either locally or in CI.
Locally, I was able to change this by manually editing Checkbox.js to change
const defaultIcon = iconDb[8]
to
var defaultIcon = iconDb[8]
However, this isn't an option in my CI environment.
This is the error produced:
$ jest --coverage
FAIL ./App.test.js
โ Test suite failed to run
/home/travis/build/danascheider/inview-login-service/node_modules/react-native-checkbox-heaven/src/CheckBox.js: "defaultIcon" is read-only
32 |
33 | if (index !== -1) {
> 34 | defaultIcon = iconDb[index]
| ^
35 | }
36 |
37 | const { component: Icon, checkedIconName, uncheckedIconName } = defaultIcon
It's better to change it to 'let', rather than 'var'.
Whoops, you're right, thanks!
When will this version be released? We're being blocked by this issue right now.
For anyone else who comes here, we fixed this by changing our package.json to point directly at this repo:
"react-native-checkbox-heaven": "ismayilmalik/react-native-checkbox-heaven#50b5c94",
@jeremyhon, it is merged 23 days ago, so should be in the most updated version.
Cheers
Will publish today, Thanks
Thank you!
version 0.1.6 now available on npm registry :)