Support for Expo managed workflow
See original GitHub issueNew Feature Request
Current Limitation
It appears to me that at least additional instructions are needed in order to be able to run a Expo managed workflow without compilation errors, if that’s even possible at all.
Feature / Enhancement Description
After configuring the code to run in RN environment in the following manner:
import Moralis from "moralis/react-native";
import { MoralisProvider } from "react-moralis";
const getMoralis = () => Moralis
export default function App() {
return (
<MoralisProvider
environment="native"
getMoralis={getMoralis}
appId="dxtPXb6rRSzQnIAcgIKScHS5sxrUI0dvmgO8xiQs"
serverUrl="https://si9oaram1zec.usemoralis.com:2053/server">
I still get the following error when trying to run a newly created expo managed project:
[00:58:05] Android Bundling failed 15409ms
[00:58:05] Unable to resolve module events from D:\projects_2021\moralis\my-app\node_modules\moralis\lib\react-native\MoralisWeb3.js: events could not be found within the project or in these directories:
[00:58:05] node_modules\moralis\node_modules
[00:58:05] node_modules
[00:58:05]
[00:58:05] If you are sure the module exists, try these steps:
[00:58:05] 1. Clear watchman watches: watchman watch-del-all
[00:58:05] 2. Delete node_modules and run yarn install
[00:58:05] 3. Reset Metro's cache: yarn start --reset-cache
[00:58:05] 4. Remove the cache: rm -rf /tmp/metro-*
[00:58:05] 167 | }
[00:58:05] 168 |
[00:58:05] > 169 | var EventEmitter = require('events');
[00:58:05] | ^
[00:58:05] 170 |
[00:58:05] 171 | var EthereumEvents = {
[00:58:05] 172 | CONNECT: 'connect',
Alternatives / Workarounds
With additional configuration based on this repository it’s possible to fix some dependency errors, one important issue to overcome being the fact that managed workflow projects rely on expo-crypto
instead of react-native-crypto
.
3rd Party References
expo-crypto
feature set support is described here: https://docs.expo.dev/versions/latest/sdk/crypto/
Expo support discussion thread: https://expo.canny.io/feature-requests/p/crypto-api
Moralis + RN boilerplate: https://github.com/ethereum-boilerplate/ethereum-react-native-boilerplate
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Closing this issue as it is rather an implementation issue. The recommended way to use react-native is to use https://github.com/ethereum-boilerplate/ethereum-react-native-boilerplate
Any questions or support can be asked in the forum as we are more active there with support and developers 😃
@ErnoW expo is a great tool for working with react-native, I think this should be addressed