Open MichelDiz opened 6 years ago
Encountered the same problem with next.js. The above error is because react-native-elements was trying to import from react-native instead of react-native-web. I didn't find a good way to change react-native-elements (the dependency of my project) import paths dynamically, but I tried re-transpile react-native-elements with a babel-plugin-module-resolver. Put the following into your node_modules/react-native-elements/.babelrc and run "yarn" & "yarn run build:dist" in react-native-elements. "plugins": [ ["module-resolver", { "alias": { "react-native": "react-native-web", } }] ]
The above can only solve the reac-native-web related issues. I was then stucked in a few other issues related to react-native-vector-icons. The following error is what I get:
Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.keys (
I guess some import paths from react-native-elements to react-native-vector-icons was messed up. Probably we need to wait for some examples for next.js later on.
I've tested your implementation and it works perfectly. Now, I was wondering if it would be possible to have that same aproach with NextJS. They have a number of pre-shaped things including babel, webpack and others.
PS. I'm interested in react-native-elements.
I'm new to NextJS, but so far everything I've explored from them made me like it.
I tried to formulate something with your configs but I always have some problem or another. See the example below - it's the last alley I got stuck.
ref: https://github.com/zeit/next.js/tree/canary/examples
more refs: https://github.com/zeit/next.js/issues/858#issuecomment-359195296 https://spectrum.chat/thread/e055ef10-ea2f-4de6-8041-b4a2ca2f5e39
examples with RNW: https://github.com/aligos/next-rnw https://github.com/zeit/next.js/tree/canary/examples/with-react-native-web
Cheers