Skip to content
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

Fix for unsupported platforms #22

Merged
merged 3 commits into from
Oct 2, 2018

Conversation

brunolemos
Copy link
Contributor

@brunolemos brunolemos commented Oct 2, 2018

Fixes #13 for real
Fixes react-navigation/react-navigation#5004

Use different index.js files for supported and unsupported platforms.

Tested on iOS and on an existing web project that uses react-navigation.


'react-native' does not contain an export named 'requireNativeComponent'.

Necolas explained here that this import should not be on any file that runs on web: necolas/react-native-web#507 (comment)

Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @brunolemos This is 💯

@kmagiera kmagiera merged commit 4cf7b82 into software-mansion:master Oct 2, 2018
@kmagiera
Copy link
Member

kmagiera commented Oct 2, 2018

hey @brunolemos I was just testing it and it appears this just disables screens completely on mobile. The reason is that packager picks screens.js first which does not include any references to native containers. Would it be ok if I rename screen.js -> screens.web.js?

@kmagiera
Copy link
Member

kmagiera commented Oct 2, 2018

I actually went ahead and made these changes (now we only have screens.web.js and screens.native.js in src/)

I published it on NPM under 1.0.0-alpha.14, do you mind testing this with your react native web project when you get a minute @brunolemos ??

@brunolemos
Copy link
Contributor Author

brunolemos commented Oct 2, 2018

The reason is that packager picks screens.js

This is weird, the default packager is supposed to prioritize .xxx.js over .js.

But ok, just tested your changes and it worked on web so all fine!

The way you did is cleaner, but I avoided doing this way because .native.js will also run on some other platforms like Windows (I think), and because now the fix is only targeting web specifically, not a fallback for "all unsupported platforms".

@kmagiera
Copy link
Member

kmagiera commented Oct 3, 2018

Thanks for checking!

I wouldn't be concerned about other native platforms as long as they have requireNativeComponent method (I think only web is missing that). When the native component isn't available we are handling that gracefully as this package is not meant just yet to be obligatory. So there are people who don't have it installed and the native views are not available in which case we fallback to using Views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants