'How to generate mnemonics in React Native?

I want to generate mnemonics in React Native. I have cloned this project. I imported bip39 but I am getting this error in mobile/simulator. Works fine in debug mode in Chrome browser.

library Error: Secure random number generation is not supported by this browser

I installed bip39 react native library. But when I use that module app is not opening and gets stuck in the splash screen. I tried to use other libraries like bit core bip39, but every lib has the same problem.

How can I create mnemonics in React Native using the above repository which I cloned React Native web3 boiler plate?



Solution 1:[1]

Working with web3 in react-native i faced this issue a few. You are probably using the bip39 node.js package. The output you get means that is using a browser library that is not present in react-native(it is probably added as dependency in node). What you should use is bip39 for react native, here is a link to it.

Solution 2:[2]

I generated the memonic using @medardm/react-native-bip39 on React Native project.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nikos fotiadis
Solution 2 Tyler Fyu