@umituz/react-native-auth 2.6.18 → 2.6.20

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": "2.6.18",
3
+ "version": "2.6.20",
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",
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * Auth Error Display Component
3
- * Displays authentication errors
3
+ * Displays authentication errors using design system tokens
4
4
  */
5
5
 
6
6
  import React from "react";
7
- import { View, Text, StyleSheet } from "react-native";
7
+ import { View, StyleSheet } from "react-native";
8
+ import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
8
9
 
9
10
  interface AuthErrorDisplayProps {
10
11
  error: string | null;
@@ -13,13 +14,28 @@ interface AuthErrorDisplayProps {
13
14
  export const AuthErrorDisplay: React.FC<AuthErrorDisplayProps> = ({
14
15
  error,
15
16
  }) => {
17
+ const tokens = useAppDesignTokens();
18
+
16
19
  if (!error) {
17
20
  return null;
18
21
  }
19
22
 
20
23
  return (
21
- <View style={styles.errorContainer}>
22
- <Text style={styles.errorText}>{error}</Text>
24
+ <View
25
+ style={[
26
+ styles.errorContainer,
27
+ {
28
+ backgroundColor: tokens.colors.errorLight,
29
+ borderColor: tokens.colors.error,
30
+ },
31
+ ]}
32
+ >
33
+ <AtomicText
34
+ type="body"
35
+ style={[styles.errorText, { color: tokens.colors.error }]}
36
+ >
37
+ {error}
38
+ </AtomicText>
23
39
  </View>
24
40
  );
25
41
  };
@@ -29,12 +45,9 @@ const styles = StyleSheet.create({
29
45
  marginBottom: 16,
30
46
  padding: 14,
31
47
  borderRadius: 12,
32
- backgroundColor: "rgba(255, 59, 48, 0.1)",
33
48
  borderWidth: 1,
34
- borderColor: "rgba(255, 59, 48, 0.2)",
35
49
  },
36
50
  errorText: {
37
- color: "#FF3B30",
38
51
  fontSize: 14,
39
52
  textAlign: "center",
40
53
  fontWeight: "500",
@@ -30,8 +30,8 @@ export const ProfileSection: React.FC<ProfileSectionProps> = ({
30
30
  profile,
31
31
  onPress,
32
32
  onSignIn,
33
- signInText = "Sign In",
34
- anonymousText = "Anonymous User",
33
+ signInText,
34
+ anonymousText,
35
35
  }) => {
36
36
  const tokens = useAppDesignTokens();
37
37
 
@@ -38,9 +38,24 @@ export function useAuthState(): UseAuthStateResult {
38
38
 
39
39
  // Memoize user to prevent new object reference on every render
40
40
  const user = useMemo(() => {
41
+ // If no Firebase user, return null
42
+ if (!firebaseUser) return null;
43
+
44
+ // If Firebase user exists and is NOT anonymous, always return the user
45
+ // This ensures real authenticated users (email, Google, Apple) always have user object
46
+ // even if isGuest was previously true (which gets reset by useEffect below)
47
+ if (!firebaseUser.isAnonymous) {
48
+ return mapToAuthUser(firebaseUser);
49
+ }
50
+
51
+ // If Firebase user is anonymous AND we're in guest mode, return null
52
+ // Guest mode = user clicked "Continue as Guest" with no account
41
53
  if (isGuest) return null;
54
+
55
+ // If Firebase user is anonymous but NOT in guest mode, return the user
56
+ // This handles anonymous auth accounts that can be upgraded later
42
57
  return mapToAuthUser(firebaseUser);
43
- }, [isGuest, firebaseUser?.uid]);
58
+ }, [isGuest, firebaseUser?.uid, firebaseUser?.isAnonymous]);
44
59
 
45
60
  // Anonymous users are NOT authenticated - they need to register/login
46
61
  const isAuthenticated = !!user && !isGuest && !user.isAnonymous;