-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Wallet from Mnemonic Throwing an error (React-Native) #338
Comments
I wonder if it is a missing stub? The RN environment is missing a lot of JavaScript basics... :s There is no more info as to what the Type is? Do you know if RN will pick up the |
Heya! So, I think I've solved the RN issues... Can you upgrade to // Import the required shims
import 'ethers/dist/shims.js';
// Import the ethers library
import { ethers } from 'ethers'; Notes: https://docs.ethers.io/ethers.js/html/cookbook-react.html |
Unfortunately that didn't work, still getting the exact same type error. I tried using both the minified and non minified versions of ethers . The non minified version now works on version 4.0.9, however only for creating a wallet via private key (which also still works with the minified version).
|
What version of RN are you using? I have the following code (just the stock demo app):
Which works fine. Can you produce a minimum app that reproduces this error? |
(I was just using the Chinese word list to check another issue; it shouldn't be required) |
Using your exact demo app code I still get the type error. I am using expo SDK 30.0.0 which uses RN 0.55.4. I also created a brand new create react native expo app (using the same SDK version 30.0.0) to ensure that it wasn't anything project specific and got the same type error again. |
Mind jumping in the ethers Lobby for a minute to help narrow this down? |
Huge thanks to @raymogg for helping identify the issue. It seems like on Linux, the node compiled does not implement String.prototype.normalize (or more accurately, implements it with a function that always throws). The new shims check the normalize actually works, and on platforms that do not work, forces a shim. Thanks! Let me know if you have any more issues. :) |
I think this is now closed, a few people have confirmed it was fixed for them. If not, please re-open. Thanks! :) |
I am facing TypeError on React Native.
Added those line, the problems still occur |
Same problem Do you need more info? |
Have you added the shims as required? |
Ok... I think we've finally put this to bed in For those interested, @marcelomorgado and I tracked it down to some platforms partially supporting The shims will now check that all normalization forms are present and that they work, if this check fails, the shim is added. Thanks! :) |
When attempting to generate a wallet using a mnemonic in React Native the following error occurs:
[16:45:48] TypeError: TypeError: Type error
This error is located at:
in Home (at SceneView.js:9)
in SceneView (at DrawerView.js:87)
in RCTView (at View.js:60)
in View (at DrawerLayoutAndroid.android.js:184)
in AndroidDrawerLayout (at DrawerLayoutAndroid.android.js:198)
in DrawerLayoutAndroid (at DrawerView.js:84)
in DrawerView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:376)
in NavigationContainer (at App.js:15)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error is located at:
in NavigationContainer (at App.js:15)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error also occurs when attempting to create a random wallet. This is the code used to generate the error.
I am guessing this may be related to #330 as I have had to use the minified version to use Ethers js in the react native app.
The text was updated successfully, but these errors were encountered: