@umituz/react-native-auth 2.6.23 → 2.7.1
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 +1 -1
- package/src/presentation/components/AccountActions.tsx +2 -2
- package/src/presentation/components/AuthBottomSheet.styles.ts +0 -7
- package/src/presentation/components/AuthBottomSheet.tsx +9 -9
- package/src/presentation/components/AuthDivider.tsx +16 -20
- package/src/presentation/components/AuthFormCard.tsx +8 -5
- package/src/presentation/components/AuthHeader.tsx +18 -35
- package/src/presentation/components/AuthLink.tsx +10 -21
- package/src/presentation/hooks/useAuthState.ts +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
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",
|
|
@@ -47,7 +47,7 @@ export const AccountActions: React.FC<AccountActionsProps> = ({ config }) => {
|
|
|
47
47
|
try {
|
|
48
48
|
await onLogout();
|
|
49
49
|
} catch (error) {
|
|
50
|
-
|
|
50
|
+
// Silent error handling
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
},
|
|
@@ -64,7 +64,7 @@ export const AccountActions: React.FC<AccountActionsProps> = ({ config }) => {
|
|
|
64
64
|
try {
|
|
65
65
|
await onDeleteAccount();
|
|
66
66
|
} catch (error) {
|
|
67
|
-
|
|
67
|
+
// Silent error handling
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
},
|
|
@@ -21,10 +21,6 @@ export const styles = StyleSheet.create({
|
|
|
21
21
|
padding: 8,
|
|
22
22
|
zIndex: 10,
|
|
23
23
|
},
|
|
24
|
-
closeIcon: {
|
|
25
|
-
fontSize: 24,
|
|
26
|
-
fontWeight: "400",
|
|
27
|
-
},
|
|
28
24
|
header: {
|
|
29
25
|
alignItems: "center",
|
|
30
26
|
marginBottom: 24,
|
|
@@ -32,13 +28,10 @@ export const styles = StyleSheet.create({
|
|
|
32
28
|
paddingTop: 16,
|
|
33
29
|
},
|
|
34
30
|
title: {
|
|
35
|
-
fontSize: 28,
|
|
36
|
-
fontWeight: "700",
|
|
37
31
|
marginBottom: 8,
|
|
38
32
|
textAlign: "center",
|
|
39
33
|
},
|
|
40
34
|
subtitle: {
|
|
41
|
-
fontSize: 15,
|
|
42
35
|
textAlign: "center",
|
|
43
36
|
lineHeight: 22,
|
|
44
37
|
},
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useEffect, useCallback, useRef, useState, useMemo } from "react";
|
|
7
|
-
import { View,
|
|
7
|
+
import { View, TouchableOpacity } from "react-native";
|
|
8
8
|
import {
|
|
9
9
|
BottomSheetModal,
|
|
10
10
|
BottomSheetBackdrop,
|
|
11
11
|
BottomSheetScrollView,
|
|
12
12
|
} from "@gorhom/bottom-sheet";
|
|
13
13
|
import type { BottomSheetBackdropProps } from "@gorhom/bottom-sheet";
|
|
14
|
-
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
14
|
+
import { useAppDesignTokens, AtomicText, AtomicIcon } from "@umituz/react-native-design-system";
|
|
15
15
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
16
16
|
import { useAuthModalStore } from "../stores/authModalStore";
|
|
17
17
|
import { useAuth } from "../hooks/useAuth";
|
|
@@ -138,19 +138,19 @@ export const AuthBottomSheet: React.FC<AuthBottomSheetProps> = ({
|
|
|
138
138
|
style={styles.closeButton}
|
|
139
139
|
onPress={handleClose}
|
|
140
140
|
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
141
|
+
accessibilityLabel={t("common.close") || "Close"}
|
|
142
|
+
accessibilityRole="button"
|
|
141
143
|
>
|
|
142
|
-
<
|
|
143
|
-
✕
|
|
144
|
-
</Text>
|
|
144
|
+
<AtomicIcon name="close" size="md" color="secondary" />
|
|
145
145
|
</TouchableOpacity>
|
|
146
146
|
|
|
147
147
|
<View style={styles.header}>
|
|
148
|
-
<
|
|
148
|
+
<AtomicText type="headlineLarge" color="primary" style={styles.title}>
|
|
149
149
|
{mode === "login" ? t("auth.signIn") : t("auth.createAccount")}
|
|
150
|
-
</
|
|
151
|
-
<
|
|
150
|
+
</AtomicText>
|
|
151
|
+
<AtomicText type="bodyLarge" color="secondary" style={styles.subtitle}>
|
|
152
152
|
{mode === "login" ? t("auth.signInSubtitle") : t("auth.createAccountSubtitle")}
|
|
153
|
-
</
|
|
153
|
+
</AtomicText>
|
|
154
154
|
</View>
|
|
155
155
|
|
|
156
156
|
<View style={styles.formContainer}>
|
|
@@ -4,34 +4,38 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { View,
|
|
8
|
-
import {
|
|
7
|
+
import { View, StyleSheet } from "react-native";
|
|
8
|
+
import { AtomicText, useResponsiveDesignTokens } from "@umituz/react-native-design-system";
|
|
9
9
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
10
10
|
|
|
11
11
|
export const AuthDivider: React.FC = () => {
|
|
12
|
-
const tokens =
|
|
12
|
+
const tokens = useResponsiveDesignTokens();
|
|
13
13
|
const { t } = useLocalization();
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<View style={styles.divider}>
|
|
16
|
+
<View style={[styles.divider, { marginVertical: tokens.spacing.md }]}>
|
|
17
17
|
<View
|
|
18
18
|
style={[
|
|
19
19
|
styles.dividerLine,
|
|
20
|
-
{ backgroundColor: tokens.colors.borderLight
|
|
20
|
+
{ backgroundColor: tokens.colors.borderLight },
|
|
21
21
|
]}
|
|
22
22
|
/>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
<AtomicText
|
|
24
|
+
type="caption"
|
|
25
|
+
style={{
|
|
26
|
+
color: tokens.colors.textSecondary,
|
|
27
|
+
marginHorizontal: tokens.spacing.sm,
|
|
28
|
+
textTransform: "uppercase",
|
|
29
|
+
letterSpacing: 0.5,
|
|
30
|
+
}}
|
|
31
|
+
responsive
|
|
28
32
|
>
|
|
29
33
|
{t("general.or")}
|
|
30
|
-
</
|
|
34
|
+
</AtomicText>
|
|
31
35
|
<View
|
|
32
36
|
style={[
|
|
33
37
|
styles.dividerLine,
|
|
34
|
-
{ backgroundColor: tokens.colors.borderLight
|
|
38
|
+
{ backgroundColor: tokens.colors.borderLight },
|
|
35
39
|
]}
|
|
36
40
|
/>
|
|
37
41
|
</View>
|
|
@@ -42,19 +46,11 @@ const styles = StyleSheet.create({
|
|
|
42
46
|
divider: {
|
|
43
47
|
flexDirection: "row",
|
|
44
48
|
alignItems: "center",
|
|
45
|
-
marginVertical: 20,
|
|
46
49
|
},
|
|
47
50
|
dividerLine: {
|
|
48
51
|
flex: 1,
|
|
49
52
|
height: 1,
|
|
50
53
|
},
|
|
51
|
-
dividerText: {
|
|
52
|
-
marginHorizontal: 16,
|
|
53
|
-
fontSize: 13,
|
|
54
|
-
fontWeight: "500",
|
|
55
|
-
textTransform: "uppercase",
|
|
56
|
-
letterSpacing: 0.5,
|
|
57
|
-
},
|
|
58
54
|
});
|
|
59
55
|
|
|
60
56
|
|
|
@@ -5,20 +5,24 @@
|
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { View, StyleSheet } from "react-native";
|
|
8
|
-
import {
|
|
8
|
+
import { useResponsiveDesignTokens } from "@umituz/react-native-design-system";
|
|
9
9
|
|
|
10
10
|
interface AuthFormCardProps {
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const AuthFormCard: React.FC<AuthFormCardProps> = ({ children }) => {
|
|
15
|
-
const tokens =
|
|
15
|
+
const tokens = useResponsiveDesignTokens();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<View
|
|
19
19
|
style={[
|
|
20
20
|
styles.formCard,
|
|
21
|
-
{
|
|
21
|
+
{
|
|
22
|
+
backgroundColor: tokens.colors.surface,
|
|
23
|
+
borderRadius: tokens.borderRadius.xl,
|
|
24
|
+
padding: tokens.spacing.lg,
|
|
25
|
+
},
|
|
22
26
|
]}
|
|
23
27
|
>
|
|
24
28
|
<View style={styles.form}>{children}</View>
|
|
@@ -28,8 +32,7 @@ export const AuthFormCard: React.FC<AuthFormCardProps> = ({ children }) => {
|
|
|
28
32
|
|
|
29
33
|
const styles = StyleSheet.create({
|
|
30
34
|
formCard: {
|
|
31
|
-
|
|
32
|
-
padding: 24,
|
|
35
|
+
width: "100%",
|
|
33
36
|
},
|
|
34
37
|
form: {
|
|
35
38
|
width: "100%",
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { View,
|
|
8
|
-
import {
|
|
7
|
+
import { View, StyleSheet } from "react-native";
|
|
8
|
+
import { AtomicText, useResponsiveDesignTokens } from "@umituz/react-native-design-system";
|
|
9
9
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
10
10
|
|
|
11
11
|
interface AuthHeaderProps {
|
|
@@ -14,31 +14,30 @@ interface AuthHeaderProps {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const AuthHeader: React.FC<AuthHeaderProps> = ({ title, subtitle }) => {
|
|
17
|
-
const tokens =
|
|
17
|
+
const tokens = useResponsiveDesignTokens();
|
|
18
18
|
const { t } = useLocalization();
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
|
-
<View style={styles.header}>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]}
|
|
21
|
+
<View style={[styles.header, { marginBottom: tokens.spacing.xl, paddingHorizontal: tokens.spacing.md }]}>
|
|
22
|
+
<AtomicText
|
|
23
|
+
type="heading1"
|
|
24
|
+
style={{ color: tokens.colors.onPrimary, textAlign: "center" }}
|
|
25
|
+
responsive
|
|
27
26
|
>
|
|
28
27
|
{title}
|
|
29
|
-
</
|
|
28
|
+
</AtomicText>
|
|
30
29
|
{(subtitle || t("auth.subtitle")) && (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
<AtomicText
|
|
31
|
+
type="bodyMedium"
|
|
32
|
+
style={{
|
|
33
|
+
color: tokens.colors.textInverse,
|
|
34
|
+
textAlign: "center",
|
|
35
|
+
marginTop: tokens.spacing.xs,
|
|
36
|
+
}}
|
|
37
|
+
responsive
|
|
39
38
|
>
|
|
40
39
|
{subtitle || t("auth.subtitle")}
|
|
41
|
-
</
|
|
40
|
+
</AtomicText>
|
|
42
41
|
)}
|
|
43
42
|
</View>
|
|
44
43
|
);
|
|
@@ -46,23 +45,7 @@ export const AuthHeader: React.FC<AuthHeaderProps> = ({ title, subtitle }) => {
|
|
|
46
45
|
|
|
47
46
|
const styles = StyleSheet.create({
|
|
48
47
|
header: {
|
|
49
|
-
marginBottom: 28,
|
|
50
48
|
alignItems: "center",
|
|
51
|
-
paddingHorizontal: 20,
|
|
52
|
-
},
|
|
53
|
-
title: {
|
|
54
|
-
fontSize: 36,
|
|
55
|
-
fontWeight: "700",
|
|
56
|
-
marginBottom: 8,
|
|
57
|
-
textAlign: "center",
|
|
58
|
-
letterSpacing: -0.5,
|
|
59
|
-
},
|
|
60
|
-
subtitle: {
|
|
61
|
-
fontSize: 16,
|
|
62
|
-
textAlign: "center",
|
|
63
|
-
lineHeight: 22,
|
|
64
|
-
fontWeight: "400",
|
|
65
|
-
marginTop: 4,
|
|
66
49
|
},
|
|
67
50
|
});
|
|
68
51
|
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { View,
|
|
8
|
-
import { AtomicButton } from "@umituz/react-native-design-system";
|
|
9
|
-
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
7
|
+
import { View, StyleSheet } from "react-native";
|
|
8
|
+
import { AtomicText, AtomicButton, useResponsiveDesignTokens } from "@umituz/react-native-design-system";
|
|
10
9
|
|
|
11
10
|
interface AuthLinkProps {
|
|
12
11
|
text: string;
|
|
@@ -21,23 +20,22 @@ export const AuthLink: React.FC<AuthLinkProps> = ({
|
|
|
21
20
|
onPress,
|
|
22
21
|
disabled = false,
|
|
23
22
|
}) => {
|
|
24
|
-
const tokens =
|
|
23
|
+
const tokens = useResponsiveDesignTokens();
|
|
25
24
|
|
|
26
25
|
return (
|
|
27
|
-
<View style={styles.container}>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]}
|
|
26
|
+
<View style={[styles.container, { marginTop: tokens.spacing.xs, paddingTop: tokens.spacing.xs }]}>
|
|
27
|
+
<AtomicText
|
|
28
|
+
type="bodyMedium"
|
|
29
|
+
style={{ color: tokens.colors.textSecondary }}
|
|
30
|
+
responsive
|
|
33
31
|
>
|
|
34
32
|
{text}{" "}
|
|
35
|
-
</
|
|
33
|
+
</AtomicText>
|
|
36
34
|
<AtomicButton
|
|
37
35
|
variant="text"
|
|
38
36
|
onPress={onPress}
|
|
39
37
|
disabled={disabled}
|
|
40
|
-
style={
|
|
38
|
+
style={{ paddingHorizontal: tokens.spacing.xxs }}
|
|
41
39
|
>
|
|
42
40
|
{linkText}
|
|
43
41
|
</AtomicButton>
|
|
@@ -50,15 +48,6 @@ const styles = StyleSheet.create({
|
|
|
50
48
|
flexDirection: "row",
|
|
51
49
|
justifyContent: "center",
|
|
52
50
|
alignItems: "center",
|
|
53
|
-
marginTop: 8,
|
|
54
|
-
paddingTop: 8,
|
|
55
|
-
},
|
|
56
|
-
text: {
|
|
57
|
-
fontSize: 15,
|
|
58
|
-
fontWeight: "400",
|
|
59
|
-
},
|
|
60
|
-
button: {
|
|
61
|
-
paddingHorizontal: 4,
|
|
62
51
|
},
|
|
63
52
|
});
|
|
64
53
|
|
|
@@ -115,22 +115,6 @@ export function useAuthState(): UseAuthStateResult {
|
|
|
115
115
|
};
|
|
116
116
|
}, []);
|
|
117
117
|
|
|
118
|
-
// Debug logging in development
|
|
119
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
120
|
-
console.log("[useAuthState] Current state:", {
|
|
121
|
-
hasUser: !!user,
|
|
122
|
-
userUid: user?.uid,
|
|
123
|
-
userEmail: user?.email,
|
|
124
|
-
userIsAnonymous: user?.isAnonymous,
|
|
125
|
-
isAuthenticated,
|
|
126
|
-
isGuest,
|
|
127
|
-
loading,
|
|
128
|
-
firebaseLoading,
|
|
129
|
-
hasFirebaseUser: !!firebaseUser,
|
|
130
|
-
firebaseUserUid: firebaseUser?.uid,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
118
|
return {
|
|
135
119
|
user,
|
|
136
120
|
isAuthenticated,
|