-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Add support for native pseudo-OS to Platform.select #26966
Conversation
Hi koke! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.
Note that running |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Hey @koke! Thanks for this PR. I think it makes sense to support this via
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for submitting the Metro PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: **Summary** In facebook/react-native#26966 I propose adding a `native` variant to `Platform.select`, similar to the existing platform-specific extensions. This PR adds supports for that in Metro's inline plugin. **Test plan** Added a couple unit tests. `yarn test inline` is passing, `yarn test` is failing some seemingly unrelated tests (some issues with package.json in metro-babel7-plugin-react-transform) cc cpojer Pull Request resolved: #480 Differential Revision: D18323629 Pulled By: cpojer fbshipit-source-id: 15ef01df5e31ab744bf9e9829928f96908f8c4ce
Summary
When you write platform-specific code using file extensions, you can specify
.ios.js
,.android.js
, or the catch-all.native.js
when you are sharing code with a web project.This
native
shortcut is missing for thePlatform.select
method, and this PR is adding support for that.Changelog
[General] [Added] - Platform.select now supports native as an option.
Test Plan
Added relevant passing unit tests for Platform module.