-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PKG -- [fcl] Stop polling when React Native WebBrowser closed (#1690)
* PKG -- [fcl] Stop polling when React Native WebBrowser closed * changeset
- Loading branch information
Showing
4 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"@onflow/fcl": patch | ||
--- | ||
|
||
Stop polling in React Native when browser has been closed |
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
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,16 @@ | ||
import * as WebBrowser from 'expo-web-browser'; | ||
import * as WebBrowser from "expo-web-browser" | ||
|
||
export function renderBrowser(src) { | ||
const webbrowser = WebBrowser.openAuthSessionAsync(src.toString()); | ||
export function renderBrowser(src, opts = {}) { | ||
const webbrowser = WebBrowser.openAuthSessionAsync(src.toString()) | ||
|
||
const unmount = () => { | ||
WebBrowser.dismissAuthSession() | ||
} | ||
|
||
// Call onClose when the webbrowser is closed | ||
webbrowser.then(() => { | ||
opts?.onClose() | ||
}) | ||
|
||
return [webbrowser, unmount] | ||
} |