Page MenuHomePhabricator

D8586.diff
No OneTemporary

D8586.diff

diff --git a/native/utils/alert.js b/native/utils/alert.js
new file mode 100644
--- /dev/null
+++ b/native/utils/alert.js
@@ -0,0 +1,48 @@
+// @flow
+
+import { Alert } from 'react-native';
+
+import { store } from '../redux/redux-setup.js';
+import { type GlobalTheme, defaultGlobalThemeInfo } from '../types/themes.js';
+
+type AlertWrapper = {
+ +alert: typeof Alert.alert,
+ +prompt: typeof Alert.prompt,
+};
+
+const getCurrentTheme = (): GlobalTheme =>
+ store.getState().globalThemeInfo.activeTheme ||
+ defaultGlobalThemeInfo.activeTheme;
+
+const alertWrapper: AlertWrapper = {
+ alert(title, message, buttons, options) {
+ Alert.alert(title, message, buttons, {
+ userInterfaceStyle: getCurrentTheme(),
+ ...options,
+ });
+ },
+ prompt(
+ title,
+ message,
+ callbackOrButtons,
+ type,
+ defaultValue,
+ keyboardType,
+ options,
+ ) {
+ Alert.prompt(
+ title,
+ message,
+ callbackOrButtons,
+ type,
+ defaultValue,
+ keyboardType,
+ {
+ userInterfaceStyle: getCurrentTheme(),
+ ...options,
+ },
+ );
+ },
+};
+
+export default alertWrapper;

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 5, 2:02 PM (21 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2244011
Default Alt Text
D8586.diff (1 KB)

Event Timeline