I use React Native with Expo, Expo Router and Metro to build a map application. I used react-native-maps package. React-native-maps is not available for the web (https://docs.expo.dev/versions/latest/sdk/map-view/), so I choose to use React Leaflet for the web. Then, in my app I do conditional rendering for rendering Leaflet on web and React Native Maps on Android and iOS.
My problem is that I have an error Unable to resolve "../Utilities/Platform" from "node_modules\react-native\Libraries\ReactPrivate\ReactNativePrivateInterface.js"
error when I try to build for the web.
I found issues on Gihub with same problem : https://github.com/react-native-maps/react-native-maps/issues/4641. To resolve the problem, the person suggest to run a postinstall script. I am a big newbie and I'm not sure I did the things right.
What I did :
- Create a postinstall.js script at the root of my project
- Past the content of the postinstall script
- Run
node postinstall.js
This did not solve my problem. I am pretty sure that was not the right way to do it.
What I expect to happen, is to not have the error, and being able to build for the web.