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

Fixing bugs in link and unlink #18207

Closed
wants to merge 1 commit into from
Closed

Fixing bugs in link and unlink #18207

wants to merge 1 commit into from

Conversation

rozele
Copy link
Contributor

@rozele rozele commented Mar 6, 2018

Android uses the name of the package, not the config, for the isInstalled check. Sending both parameters to isInstalled so we have a consistent API.

Motivation

A bug was uncovered in the react-native link command where Android would not unlink because the wrong parameters were being sent to isInstalled.

Test Plan

Successfully linked and unlinked react-native-fs on Windows and Mac. Jest tests pass.

Related PRs

#17000
#18131

Release Notes

[CLI][BUGFIX][local-cli/link/link.js] - Fix issue with isInstalled check for Android
[CLI][BUGFIX][local-cli/link/unlink.js] - Fix issue with isInstalled check for Android
[CLI][BUGFIX][local-cli/link/ios/common/unregisterNativeModule.js] - Fix references to unregister implementations.

@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 6, 2018
@rozele rozele changed the title Fixing bug in link and unlink Fixing bugs in link and unlink Mar 6, 2018
Android uses the `packageName` parameter, not `dependencyConfig`, for the `isInstalled` check. This change ensures both parameters are sent to `isInstalled`.

Also, the incorrect modules were being used to unlink iOS packages. That is fixed in this commit as well.
@afjoseph
Copy link

afjoseph commented Mar 6, 2018

Confirming this issue.
To recreate:

react-native init aaa
react-native install react-native-svg
react-native link react-native-svg # not necessary since `install` runs `link`
# Now react-native-svg is linked. Check `settings.gradle` for proof
react-native unlink react-native-svg
react-native uninstall react-native-svg
# `settings.gradle` shows plugin is still linked
react-native install react-native-svg
# `settings.gradle` has two instances of plugin

@Titozzz
Copy link
Collaborator

Titozzz commented Mar 7, 2018

This PR also addresses iOS unlink bug.

@grabbou
Copy link
Contributor

grabbou commented Mar 7, 2018

I am landing this right now and releasing new versions for all the affected releases (from 0.51 onwards).

@grabbou
Copy link
Contributor

grabbou commented Mar 7, 2018

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

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

1 similar comment
@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 7, 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.

Copy link
Contributor

@matthargett matthargett left a comment

Choose a reason for hiding this comment

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

Great find!

grabbou pushed a commit that referenced this pull request Mar 12, 2018
Summary:
Android uses the name of the package, not the config, for the `isInstalled` check. Sending both parameters to `isInstalled` so we have a consistent API.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

A bug was uncovered in the react-native link command where Android would not unlink because the wrong parameters were being sent to `isInstalled`.

Successfully linked and unlinked `react-native-fs` on Windows and Mac. Jest tests pass.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[CLI][BUGFIX][local-cli/link/link.js] - Fix issue with `isInstalled` check for Android
[CLI][BUGFIX][local-cli/link/unlink.js] - Fix issue with `isInstalled` check for Android
[CLI][BUGFIX][local-cli/link/ios/common/unregisterNativeModule.js] - Fix references to unregister implementations.
Closes #18207

Differential Revision: D7180885

Pulled By: hramos

fbshipit-source-id: 5f479cd9d7b1ebd8626b461e9dc1f22988e2c61f
@grabbou
Copy link
Contributor

grabbou commented Mar 15, 2018 via email

grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
Android uses the name of the package, not the config, for the `isInstalled` check. Sending both parameters to `isInstalled` so we have a consistent API.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

A bug was uncovered in the react-native link command where Android would not unlink because the wrong parameters were being sent to `isInstalled`.

Successfully linked and unlinked `react-native-fs` on Windows and Mac. Jest tests pass.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[CLI][BUGFIX][local-cli/link/link.js] - Fix issue with `isInstalled` check for Android
[CLI][BUGFIX][local-cli/link/unlink.js] - Fix issue with `isInstalled` check for Android
[CLI][BUGFIX][local-cli/link/ios/common/unregisterNativeModule.js] - Fix references to unregister implementations.
Closes facebook/react-native#18207

Differential Revision: D7180885

Pulled By: hramos

fbshipit-source-id: 5f479cd9d7b1ebd8626b461e9dc1f22988e2c61f
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants