Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome. #59

Open
mfbx9da4 opened this issue Oct 13, 2021 · 2 comments

Comments

@mfbx9da4
Copy link

mfbx9da4 commented Oct 13, 2021

I've been trying to get started with a fresh project and I've hit multiple stumbling blocks. My fresh project is a fork of the recommended react native typescript template.

  1. Had to enable use_frameworks!.
  2. Had to disable flipper as was recommended, presumably because flipper depended on use_frameworks being disabled.
  3. Had to tweak some other packages to be compatible with use_frameworks!. In my case I had to enable $RNFirebaseAsStaticFramework = true for firebase.
  4. When using react-native@0.66, I had to do a force install because the packages because virgil packages don not declare themselves as compatible with react@17 npm i @virgilsecurity/e3kit-native @virgilsecurity/key-storage-rn react-native-keychain react-native-virgil-crypto --force. Also had to install npm i @react-native-async-storage/async-storage instead of the recommended @react-native-community/async-storage

After all this it "works" provided debugging is not enabled. If I enable remote debugging I get the following error when using virgil APIs

Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome.

This error is present with react-native@0.62 and react-native@0.66 configurations.

@mfbx9da4
Copy link
Author

I'm also experiencing this with 0.62

@mfbx9da4 mfbx9da4 changed the title React-native 0.66 not supported - Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome. Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome. Oct 13, 2021
@mfbx9da4
Copy link
Author

looking through the source the issue is that the library always exports with RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD. So this error is guaranteed to happen... Do I have to fork the library and re-export everything with RCT_EXPORT_METHOD?

https://github.com/VirgilSecurity/react-native-virgil-crypto/blob/master/ios/RNVirgilCrypto.m#L66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant