-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[Refactor] Add cross-platform Linking module #5336
Conversation
We also need to decide what to do with
It'd also be nice to provide a codemod to automate the transition. Will see if I can work on it. |
Expose Linking module Use Flow in Linking
Option 1 is my preferred approach. Then in the next release we can maybe move to option 2, and then eventually remove them altogether. |
@nicklockwood Awesome. I'll add the warnings. |
@satya164 updated the pull request. |
@satya164 updated the pull request. |
*/ | ||
static getInitialURL(callback: Function) { | ||
console.warn('"IntentAndroid.getInitialURL" is deprecated. Use the promise based "Linking.getInitialURL" instead.'); |
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!
Awesome! Thanks for working on this! |
@@ -85,9 +86,11 @@ public void openURL(String url) { | |||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
getReactApplicationContext().startActivity(intent); | |||
} | |||
|
|||
promise.resolve(true); |
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.
I'm confused on what should I resolve with here.
@satya164 updated the pull request. |
*/ | ||
static addEventListener(type: string, handler: Function) { | ||
if (Platform.OS === 'android') { | ||
console.error('Linking.addEventListener is not supported on Android'); |
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.
Maybe this can be just a warning, and not error?
Nice one @satya164! |
Had a quick look again, once you're happy with it feel free to shipit :) |
@christopherdro I don't use that lib, but if someone can fix it to work with this change, it'll surely be great. @mkonicek Only one doubt, what should I resolve with here - https://github.com/facebook/react-native/pull/5336/files#diff-fab623097f5131602a9aa8e4829fb6a9R90 null seems to be good candidate, but then I've no idea how to do the same with iOS - https://github.com/facebook/react-native/pull/5336/files#diff-07733d30787de00582b6e9693d4be698R83 |
@satya164 updated the pull request. |
Talked to @dmmiller . He's fine with |
@satya164 updated the pull request. |
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/844257825700338/int_phab to review. |
Summary: A promise based API for handling Link for Android and iOS. Refer facebook#4971 The iOS part doesn't handle errors. Will need someone with iOS knowledge to do that. cc skevy ide brentvatne mkonicek vjeux nicklockwood Closes facebook#5336 Reviewed By: svcscm Differential Revision: D2866664 Pulled By: androidtrunkagent fb-gh-sync-id: 67e68a827e6b85886bfa84e79b897f079e78b1b5
A promise based API for handling Link for Android and iOS. Refer #4971
The iOS part doesn't handle errors. Will need someone with iOS knowledge to do that.
cc @skevy @ide @brentvatne @mkonicek @vjeux @nicklockwood