forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Expensify#17415 from Expensify/ionatan_manywrites
Show alert when doing more than 1 write in auth in the backend
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import _ from 'underscore'; | ||
|
||
/** | ||
* Shows an alert modal with ok and cancel options. | ||
* | ||
* @param {String} title The title of the alert | ||
* @param {String} description The description of the alert | ||
* @param {Object[]} options An array of objects with `style` and `onPress` properties | ||
*/ | ||
export default (title, description, options) => { | ||
const result = _.filter(window.confirm([title, description], Boolean)).join('\n'); | ||
|
||
if (result) { | ||
const confirmOption = _.find(options, ({style}) => style !== 'cancel'); | ||
if (confirmOption && confirmOption.onPress) { | ||
confirmOption.onPress(); | ||
} | ||
} else { | ||
const cancelOption = _.find(options, ({style}) => style === 'cancel'); | ||
if (cancelOption && cancelOption.onPress) { | ||
cancelOption.onPress(); | ||
} | ||
} | ||
}; |
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 @@ | ||
import {Alert} from 'react-native'; | ||
|
||
export default Alert.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