title: ReferenceError: Can't find variable: crypto in React Native
body: <p>I'm using some auth node module in my react native application which is using <a href="https://github.com/panva/jose" rel="nofollow noreferrer">jose</a> as a dependency. I get the following error which I believe is due to the fact that <strong>in-build typescript/ node libraries are not supported by React native</strong>.</p>
  <blockquote>
  <p>ERROR    ReferenceError: Can't find variable: crypto ERROR<br />
  Invariant Violation: Module AppRegistry is not a registered callable
  module (calling runApplication)</p>
  </blockquote>
  <p>Even using <a href="https://github.com/parshap/node-libs-react-native" rel="nofollow noreferrer">node-libs-react-native</a> or <a href="https://www.npmjs.com/package/rn-nodeify" rel="nofollow noreferrer">rn-nodify</a> in my app didn't fix the issue. It appears adding a resolver to <code>metro.config.js</code> to provide extra node modules doesn't fix the issue for the libraries used by dependencies (here jose is used by the auth library and jose is using crypto).</p>
  <p>Any solution or workaround to get this into working?</p>
  <p>I found 2 similar issues, <strong>but nothing mentioned there worked for me</strong>.</p>
  <ol>
  <li><a href="https://stackoverflow.com/questions/29836434/requiring-unknown-module-crypto-in-react-native-environment">Requiring unknown module &quot;crypto&quot; in react-native environment</a></li>
  <li><a href="https://stackoverflow.com/questions/52697108/unable-to-resolve-module-crypto-in-reactnative/69265048#69265048">Unable to resolve module crypto in reactnative</a></li>
  </ol>