New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Other packages can't resolve DeviceInfo and ViewPagerAndroid any more #801
Comments
+1 |
Those modules are not supported on web. You shouldn't expect platform specific code or every RN package to run on web |
Got that. But how to avoid these errors ? |
@necolas For StatusBar a stub is provided, will you accept a PR to do the same for DeviceInfo and ViewPagerAndroid? |
You can avoid these errors by not bundling those packages in your web app. React Navigation has no web support. |
RNW doesn't stub any iOS/Android-only components. DeviceInfo is an undocumented native module, so no plans to stub that either right now |
React Navigation was in a sorry state (even though it was the recommended router for RN), and I complained about it there. Many people did. Thankfully some people took that to heart, and the situation has improved tremendously. Because of that they did not make react-native-web support a priority for 1.0. But they stated that they do intend to add it later. And it works reasonably well for now. I can follow you on using private props, and I will create a PR for react-native-dropdownalert, but this is making it really hard for people like me, who want to share codebases between app and web. |
The problem lies in packages that assume only iOS/Android exists. You should avoid them or only import them in |
I'd like your advice on something. But now I want to use React Navigation 1.0.0. They use react-native-tab-view, which is: "A cross-platform Tab View component for React Native.". Now, that package provides a (/react-native-tab-view/src/TabViewPagerAndroid.js)
Which throws the error: Now what would be the best way to fix this? react-native is aliased to react-native-web, import statements cannot be wrapped in a condition. Do I create a PR for react-native-tab-view, which creates a directory - say - This ties into your remark that "The problem lies in packages that assume only iOS/Android exists". The thing is, this package imports from react-native which contains a stub for ViewPagerAndroid when run on ios. So the ios and android parts do contain stubs for each other. Now I don't think they will continue providing platform specific components, wouldn't it just be simpler to have react-native-web also provide stubs for those platform-specific components and be done with it? If not, can you help me in learning wat is the best way of moving forward with this? Thanks. |
I guess this is a bug. (but what do I know)
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and
if a minimal demo of the problem via Glitch or similar (template:
https://glitch.com/edit/#!/react-native-web-playground).
If this is really neceswsary I can provide it, but me-thinks the maintainers will immediately know what's happening here.
What is the expected behavior?
No errors.
Environment (include versions). Did this work in previous versions?
It worked in 0.3.0-rc.4
Here's my package.json:
and my webpack config:
.babelrc
The text was updated successfully, but these errors were encountered: