@umituz/react-native-auth 3.6.33 → 3.6.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-auth",
3
- "version": "3.6.33",
3
+ "version": "3.6.35",
4
4
  "description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -5,8 +5,9 @@
5
5
  */
6
6
 
7
7
  import React from "react";
8
- import { View, TouchableOpacity, StyleSheet, Alert } from "react-native";
9
- import { useAppDesignTokens, AtomicIcon, AtomicText } from "@umituz/react-native-design-system";
8
+ import { View, TouchableOpacity, StyleSheet } from "react-native";
9
+ import { useAppDesignTokens, AtomicIcon, AtomicText, useAlert, AlertType, AlertMode } from "@umituz/react-native-design-system";
10
+ import { useLocalization } from "@umituz/react-native-localization";
10
11
 
11
12
  export interface AccountActionsConfig {
12
13
  logoutText: string;
@@ -30,6 +31,8 @@ export interface AccountActionsProps {
30
31
 
31
32
  export const AccountActions: React.FC<AccountActionsProps> = ({ config }) => {
32
33
  const tokens = useAppDesignTokens();
34
+ const alert = useAlert();
35
+ const { t } = useLocalization();
33
36
  const {
34
37
  logoutText,
35
38
  deleteAccountText,
@@ -47,41 +50,53 @@ export const AccountActions: React.FC<AccountActionsProps> = ({ config }) => {
47
50
  } = config;
48
51
 
49
52
  const handleLogout = () => {
50
- Alert.alert(logoutConfirmTitle, logoutConfirmMessage, [
51
- { text: "Cancel", style: "cancel" },
52
- {
53
- text: logoutText,
54
- style: "destructive",
55
- onPress: () => {
56
- void (async () => {
53
+ alert.show(AlertType.WARNING, AlertMode.MODAL, logoutConfirmTitle, logoutConfirmMessage, {
54
+ actions: [
55
+ {
56
+ id: "cancel",
57
+ label: t("common.cancel"),
58
+ style: "secondary",
59
+ onPress: () => {},
60
+ },
61
+ {
62
+ id: "confirm",
63
+ label: logoutText,
64
+ style: "destructive",
65
+ onPress: async () => {
57
66
  try {
58
67
  await onLogout();
59
68
  } catch (error) {
60
69
  // Silent error handling
61
70
  }
62
- })();
71
+ },
63
72
  },
64
- },
65
- ]);
73
+ ],
74
+ });
66
75
  };
67
76
 
68
77
  const handleDeleteAccount = () => {
69
- Alert.alert(deleteConfirmTitle, deleteConfirmMessage, [
70
- { text: "Cancel", style: "cancel" },
71
- {
72
- text: deleteAccountText,
73
- style: "destructive",
74
- onPress: () => {
75
- void (async () => {
78
+ alert.show(AlertType.ERROR, AlertMode.MODAL, deleteConfirmTitle, deleteConfirmMessage, {
79
+ actions: [
80
+ {
81
+ id: "cancel",
82
+ label: t("common.cancel"),
83
+ style: "secondary",
84
+ onPress: () => {},
85
+ },
86
+ {
87
+ id: "confirm",
88
+ label: deleteAccountText,
89
+ style: "destructive",
90
+ onPress: async () => {
76
91
  try {
77
92
  await onDeleteAccount();
78
93
  } catch (error) {
79
- Alert.alert(deleteErrorTitle, deleteErrorMessage);
94
+ alert.showError(deleteErrorTitle, deleteErrorMessage, { mode: AlertMode.MODAL });
80
95
  }
81
- })();
96
+ },
82
97
  },
83
- },
84
- ]);
98
+ ],
99
+ });
85
100
  };
86
101
 
87
102
  return (
@@ -6,7 +6,7 @@
6
6
 
7
7
  import React from "react";
8
8
  import { View, TouchableOpacity, StyleSheet } from "react-native";
9
- import { useAppDesignTokens, ScreenLayout, AtomicIcon, AtomicText } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens, ScreenLayout, AtomicIcon, AtomicText, NavigationHeader, useAppNavigation } from "@umituz/react-native-design-system";
10
10
 
11
11
  import { ProfileSection, type ProfileSectionConfig } from "../components/ProfileSection";
12
12
  import { AccountActions, type AccountActionsConfig } from "../components/AccountActions";
@@ -18,6 +18,7 @@ export interface AccountScreenConfig {
18
18
  editProfileText?: string;
19
19
  onEditProfile?: () => void;
20
20
  onSignIn?: () => void;
21
+ title?: string;
21
22
  }
22
23
 
23
24
  export interface AccountScreenProps {
@@ -26,9 +27,16 @@ export interface AccountScreenProps {
26
27
 
27
28
  export const AccountScreen: React.FC<AccountScreenProps> = ({ config }) => {
28
29
  const tokens = useAppDesignTokens();
30
+ const navigation = useAppNavigation();
29
31
 
30
32
  return (
31
33
  <ScreenLayout
34
+ header={
35
+ <NavigationHeader
36
+ title={config.title || "Account Settings"}
37
+ onBackPress={() => navigation.goBack()}
38
+ />
39
+ }
32
40
  scrollable={true}
33
41
  edges={['bottom']}
34
42
  backgroundColor={tokens.colors.backgroundPrimary}