mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Resolve Promise to YES for Linking.openURL (#24955)
Summary: The `Linking.openURL()` method is supposed to resolve to a `true` `Promise` when the URL was properly open. However, in iOS, the `Promise` was resolving to `nil`. So I fixed this issue by making it resolve to `YES` (`true`), just like on Android. ## Changelog [iOS] [Fixed] - Fix return value of `Linking.openURL()` Pull Request resolved: https://github.com/facebook/react-native/pull/24955 Differential Revision: D15411994 Pulled By: cpojer fbshipit-source-id: 90bdd6cfae8d69d7a239a0b4c84d75859e293b32
This commit is contained in:
1 parent
14b4668947
commit
4a5d0bdbd7
1 file changed
+2
-2
@@ -95,7 +95,7 @@ RCT_EXPORT_METHOD(openURL:(NSURL *)URL
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[RCTSharedApplication() openURL:URL options:@{} completionHandler:^(BOOL success) {
|
||||
if (success) {
|
||||
resolve(nil);
|
||||
resolve(@YES);
|
||||
} else {
|
||||
reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ RCT_EXPORT_METHOD(openURL:(NSURL *)URL
|
||||
} else {
|
||||
BOOL opened = [RCTSharedApplication() openURL:URL];
|
||||
if (opened) {
|
||||
resolve(nil);
|
||||
resolve(@YES);
|
||||
} else {
|
||||
reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user