-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[menu-bar] Fix undismissable Alerts (#112)
* [menu-bar] Fix undismissable Alerts * Add changelog entry
- Loading branch information
1 parent
078917d
commit b1e2e87
Showing
6 changed files
with
33 additions
and
4 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
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,25 @@ | ||
import { Alert as RNAlert, AlertOptions, AlertButton } from 'react-native'; | ||
|
||
type MacOSAlertOptions = AlertOptions & { | ||
modal?: boolean; | ||
critical?: boolean; | ||
}; | ||
|
||
/** | ||
* A wrapper around RNAlert to override the | ||
* default alert and set modal true, that way | ||
* users can dismiss it even without an active window | ||
**/ | ||
const Alert = { | ||
...RNAlert, | ||
alert( | ||
title: string, | ||
message?: string, | ||
buttons?: AlertButton[], | ||
options: MacOSAlertOptions = {} | ||
): void { | ||
RNAlert.alert(title, message, buttons, { modal: true, ...options }); | ||
}, | ||
}; | ||
|
||
export default Alert; |
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