-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26884 from software-mansion-labs/ts-migration/kow…
…czarz/async-open-url-lib [No QA][TS migration] Migrate 'asyncOpenURL' lib to TypeScript
- Loading branch information
Showing
3 changed files
with
18 additions
and
9 deletions.
There are no files selected for viewing
7 changes: 5 additions & 2 deletions
7
src/libs/asyncOpenURL/index.js → src/libs/asyncOpenURL/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import {Linking} from 'react-native'; | ||
import AsyncOpenURL from './types'; | ||
|
||
export default function asyncOpenURL(promise, url) { | ||
const asyncOpenURL: AsyncOpenURL = (promise, url) => { | ||
if (!url) { | ||
return; | ||
} | ||
|
||
promise.then((params) => { | ||
Linking.openURL(typeof url === 'string' ? url : url(params)); | ||
}); | ||
} | ||
}; | ||
|
||
export default asyncOpenURL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type AsyncOpenURL = <T>(promise: Promise<T>, url: string | ((params: T) => string), shouldSkipCustomSafariLogic?: boolean) => void; | ||
|
||
export default AsyncOpenURL; |