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

feat: Remove platform check in requireNativeComponent to support additional platforms #18381

Conversation

jhampton
Copy link
Contributor

Motivation

Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check. This change allows this JS file to be re-used instead of copied and modified.

Test Plan

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

Related PRs

No related PR's found :)

Release Notes

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 14, 2018
@rozele
Copy link
Contributor

rozele commented Mar 14, 2018

@jhampton #18378 😆

@jhampton
Copy link
Contributor Author

Quick question @rozele – I wasn't sure if the else if you've included was necessary. Is there another implementation we might need to support (either bubbling or lazy and ...?)

@rozele
Copy link
Contributor

rozele commented Mar 14, 2018

@jhampton the else if was to prevent iOS from calling merge - but I now see that merge works as expected when either source or destination is null, so I don't think it's necessary.

@rozele
Copy link
Contributor

rozele commented Mar 14, 2018

I'm good with this PR if you add the same change to requireNativeComponent

@jhampton
Copy link
Contributor Author

Great, thank you! Quick question @rozele : is there a reason this couldn't/shouldn't be refactored into a separate module and required in both files?

@rozele
Copy link
Contributor

rozele commented Mar 14, 2018

@jhampton - I'm supportive of a separate module.

@jhampton
Copy link
Contributor Author

I ended up making the same change to requireNativeComponent per @rozele 's original PR. I'm not sure about the future of these two files vis-a-vis the transition to Fabric and historical context, so this is sufficient for now.

Also, it looks like CI is failing on yarn ATM. I'll check back in a bit later.

@react-native-bot react-native-bot added Feature Request 🌟 Ran Commands One of our bots successfully processed a command. labels Mar 16, 2018
@hramos
Copy link
Contributor

hramos commented Mar 16, 2018

The yarn failure appears to be related to a Circle CI outage. The outage is over, and my colleagues at github.com/facebook/docusaurus found that jobs spawned from newer commits are no longer seeing the yarn failure, but I haven't had luck on this repo yet.

You may want to try pushing a dummy commit to trick Circle into running again, just in case.

@jhampton
Copy link
Contributor Author

Thank you @hramos! I tried again, and it looks like yarn is still not found.

image

@hramos
Copy link
Contributor

hramos commented Mar 17, 2018

If you rebase past 6f6084d, it should be fixed. Sorry for the trouble!

Edit: #18421 fixes the Android step, landing now.

…-requireNativeComponent' into feature/remove-platform-specific-requireNativeComponent
@jhampton
Copy link
Contributor Author

Interesting...it looks like there are quite a few eslint failures in the new tests. I should be up to date as of this morning's master.

@hramos hramos added Type: Enhancement A new feature or enhancement of an existing feature. and removed 🌟Feature Request labels Mar 19, 2018
@grabbou
Copy link
Contributor

grabbou commented Mar 20, 2018

I think I've seen CI to fail for other lint related reasons as well earlier today. I'll look into that too as I am planning on cutting few more releases today.

Meanwhile, let's try merging that.

@grabbou
Copy link
Contributor

grabbou commented Mar 20, 2018

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Something went wrong executing that command, @hramos could you take a look?

@facebook-github-bot facebook-github-bot added Failed Commands Import Started This pull request has been imported. This does not imply the PR has been approved. labels Mar 20, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@grabbou is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@grabbou
Copy link
Contributor

grabbou commented Mar 20, 2018

Interesting... 🤔

hamaron pushed a commit to hamaron/react-native that referenced this pull request Apr 9, 2018
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
campsafari pushed a commit to exozet/react-native that referenced this pull request Apr 11, 2018
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
LukeDurrant pushed a commit to LukeDurrant/react-native that referenced this pull request Apr 11, 2018
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
LukeDurrant pushed a commit to LukeDurrant/react-native that referenced this pull request Apr 11, 2018
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
bunnyc1986 pushed a commit to bunnyc1986/react-native that referenced this pull request May 11, 2018
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
macdoum1 pushed a commit to macdoum1/react-native that referenced this pull request Jun 28, 2018
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
aleclarson pushed a commit to aleclarson/react-native-macos that referenced this pull request Oct 30, 2019
…tional platforms

Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes facebook/react-native#18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved. Ran Commands One of our bots successfully processed a command. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants