From fa5ce5b46707a1ce63fef9f913ee8b3318bc0382 Mon Sep 17 00:00:00 2001 From: Dan Forbes Date: Tue, 10 Dec 2024 08:14:24 -0800 Subject: [PATCH] Add Documentation for React Native (#7419) * Add Documentation for React Native Closes #7314 * Web3.js Must be Imported as Default Import --- .../18_resources_and_troubleshooting/index.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/docs/guides/18_resources_and_troubleshooting/index.md b/docs/docs/guides/18_resources_and_troubleshooting/index.md index 8cf7327d828..e10a0b3f83b 100644 --- a/docs/docs/guides/18_resources_and_troubleshooting/index.md +++ b/docs/docs/guides/18_resources_and_troubleshooting/index.md @@ -44,6 +44,30 @@ Additional Info: [Facebook/React-native Issue #28492](https://github.com/facebook/react-native/issues/28492#issuecomment-824698934) +### TypeError: Cannot read property 'prototype' of undefined, js engine: hermes + +This error occurs when trying to use Web3.js with React Native. To solve this error, use [the `react-native-quick-crypto` package](https://www.npmjs.com/package/react-native-quick-crypto). + +**Resolution Steps:** + +1. Install `react-native-quick-crypto` as a dependency: + +```bash +yarn add react-native-quick-crypto +``` + +2. Set up `react-native-quick-crypto`: + +```bash +cd ios && pod install +``` + +3. Ensure that Web3.js is imported using the default import, as using a named import does not work: + +```bash +import Web3 from 'web3'; +``` + ## Resources ### [Web3.js v4 course](https://www.youtube.com/watch?v=3ZO_t-Kyr1g&list=PLPn3rQCo3XrP4LbQcOyyHQR8McV7w3HZT)