Scopevisio / eudgc

A totally free (Apache 2.0) implementation of the Covid Vaccination Certifcate parsing and validation (more accurately EuDGC) in Javascript/Typescript. This works completely on the client side if needed. Serverside is possible too of course.
23 stars 13 forks source link

Using eudgc with react native (BigInt problem)? #1

Closed bluepuma77 closed 2 years ago

bluepuma77 commented 3 years ago

I would like to use the eudgc library on mobile with React Native.

When I create a React Native app with eudgc integrated (example code: snack.expo.dev), I receive the error Can’t find variable: BigInt when the app is compiled.

How to reproduce: I usually just scan the "Run on your device" QR code on the Expo website from within the Android Expo app, then the compilation process is started.

During problem research I found a comment on react-native GitHub:

You are importing a package somewhere that requires BigInt as a dependency. For the most part ReactNative uses JavaScriptCore which may not have the support of BigInt.

And core-js states (all the way at the bottom):

ES BigInt can't be polyfilled since it requires changes in the behavior of operators, you could find more info here. You could try to use JSBI.

Is there a way to get eudgc to run with React Native?

srutz commented 3 years ago

Hi Bluepuma, this question has been asked before and I received feedback from Pietro from Italy that he solved that issue.

Maybe this was helpful

https://github.com/facebook/react-native/issues/28492#issuecomment-824698934

It seems like react-native doesn't support the newer ECMA features and BigInt happens to be one of them. I haven't tried to use the lib with react-native but I will try and add some recipes/solutions in the README if I find any.

If you could share your findings, that would also be greatly welcomed. Thanks.

alexduca commented 2 years ago

Someone find a solution for implementing with react-native??

srutz commented 2 years ago

Hi Alexduca, see above. The workaround here https://github.com/facebook/react-native/issues/28492#issuecomment-824698934 seemed to fix the issue. Maybe newer versions of React-Native have more recent ECMA-Script support. Eventually this would also fix the issue.

alexduca commented 2 years ago

Hello @srutz ! I read all the topic but i didn't understand where i have to change because i didn't have a shim.js file in my project.

alexduca commented 2 years ago

Someone can help me please