I want to solve this issue react-native-maps/react-native-maps#2051 this issue happen after react-native@0.53-rc.4 and 0.54. Finally I could fix this issue but my commit has not released yet. so I'll note down the ways to use it that has not released.
I know 3 ways. if you know other way, please put comment.
- specifying git repos in
package.json - using patch e.g. patch-package. and apply patch with
postinstallscript. - using scoped-package
official documentation is great. so you can read and understand this.
"react-native-maps": "https://github.com/react-community/react-native-maps.git",
see also react-native-maps/react-native-maps#2051 (comment)
Just use /usr/bin/patch. this is old way but some web engineer may not familiar. and this way may confuse windows user.
In node.js, it's easy to use patch-package.
yarn add -D patch-package- add
"prepare": "patch-package"toscriptsin package.json - mkdir
patcheson your project root and putreact-native-maps+0.20.1.patchintopatches yarn
I like this patch-package way since npm will give me warning when target pacakge get new release.
first way won't notify that.
clone git repo and publish it under your scope.
For my case, I can make @zigen/react-native-maps and $ npm install @zigen/react-native-maps (my github username is hrl7 but npm username is zigen).
However this way need to change import statement like import MapView from '@zigen/react-native-maps';.
so I made package to solve this problem. https://www.npmjs.com/package/unscope-package
if you published your scoped react-native-maps, you can unscope it by using this "unscope": ["@yourname/react-native-maps"]
I have no confidence, I suspect require-polyfill in metro.
My commit changes just the order of importing module.
Once MapView imported, the bundler may not load module from same file in paticular situation.
I tried to figure out this bug, but it won't happen...
so now I confused...