Closed 7kfpun closed 7 years ago
I suppose that's because they require react-native
directly https://github.com/aksonov/react-native-router-flux/blob/b11a84962e4e4d9265770382b8859d21d1a12ea0/src/NavBar.js#L37. Unfortunately, there is no good solution right now for aliasing this, only manually change (fork) the library and abstract react-native
. React Native macOS might be updated as a pluggable thing to react-native in the future to support all third-party plugins.
@ptmt, maybe we can write a babel plugin to transform react-native
to react-native-macos
for import / require? We can add it to transformer by default. Although there may be have a better way.
Have the same issue, maybe someone know good router for using with 'react-native-macos'?
@hmelenok This going to be resolved with https://github.com/ptmt/react-native-macos/pull/125 by @jhen0409 , you can try it right now and provide a feedback.
Seems the same now, it not found it in your version of RN
I had use fork from git+https://github.com/jhen0409/react-native-desktop.git#patch-2
.babelrc
:
{
"presets": [
"react-native"
],
"plugins": [
[
"module-resolver",
{
"alias": {
"react-native": "react-native-macos",
},
}
],
],
}
.flowconfig
:
...
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.name_mapper='react-native' -> 'react-native-macos'
...
seems as alias working but without Platform
full code there: https://github.com/hmelenok/shelfnativeMacOSX
Added Platform.select
support in 0.11.0-rc4. PR for babel transforming is still under testing
0.12.0 now have babel-transform plugin
It doesn't work with react-native-router-flux and other packages using Platform api. The error is following: