dripsy: Render Error: "Can't find variable key"
Hello!
For some reason, after upgrading from Expo 45, to either 46 or 47, I get the following error on a project running with Dripsy.
The code segment the error is referring to is line 61 of node_modules/@dripsy/core/src/css/index.tsx
. The syntax appears correct, but for some reason during runtime it is throwing an error as if variable key
didn’t exist.
For the sake of testing I tried updating the error lines to the following and it works perfectly.
The pattern seems to point to the error occurring whenever key
is not declared inside the block, but inside the for
. I have never seen such an error before.
I would really appreciate if anyone was able to shed light on the situation. I’ve tried for a couple hours to fix this and cannot make it work by installing different Dripsy versions, removing yarn.lock
and re-installing. It seems to be tied exclusively to being in an Expo SDK >=46.
Thank you!
P.S.: This also does not work
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 21 (14 by maintainers)
@nandorojo It may be some problem with the actual name
key
of the variable. On the local copy I have of Dripisy renaming it to anything else, likestyleKey
, also fixes the issue.I just made a pull request with that change, but for some reason, it is failing the CI test. It doesn’t let me access the Vercel (it appears to be private). Would you be able to tell me what is causing the error in the CI test?
I’ll fix it and update the pull request.
Released in
3.10
@inakineitor thank you so much! I updated to 3.10.0 and just needed to expo run:ios again and it started running properly.
Just want to confirm that manually implementing the fix from @inakineitor solved this for me until that gets merged. Thanks a bunch!
Now that we have @evanrs info, we know that the problem is in the interpretation before transpilation.
We can see from the images below that the original lines and the transpiled ones use the native
for ... in ...
feature, so it is not that the system does not support the feature it is being transpiled to.Maybe it has to be something with the
tsconfig
, but after looking at the changelog it appears that that file has not been touched in a while, and that the only thing that changed was the policy on unusedLocalVariables.@nandorojo I am also free to work on this if you have a direction we should follow. If you want we can implement the first fix (from the beginning of the thread) as a temporal solution. This would make the library work off the bat for new users until we can find what the root issue is.