@umituz/react-native-auth 2.6.0 → 2.6.2
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 +20 -17
- package/src/presentation/components/ProfileSection.tsx +10 -35
- package/src/presentation/components/SocialLoginButtons.tsx +4 -37
- package/src/presentation/components/icons/AppleIconSvg.tsx +24 -0
- package/src/presentation/components/icons/GoogleIconSvg.tsx +32 -0
- package/src/presentation/components/icons/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
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",
|
|
@@ -28,34 +28,37 @@
|
|
|
28
28
|
"url": "git+https://github.com/umituz/react-native-auth.git"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"react": ">=18.2.0",
|
|
33
|
-
"react-native": ">=0.74.0",
|
|
34
|
-
"@umituz/react-native-firebase-auth": "latest",
|
|
35
|
-
"@react-navigation/stack": ">=6.0.0",
|
|
31
|
+
"@gorhom/bottom-sheet": ">=4.0.0",
|
|
36
32
|
"@react-navigation/native": ">=6.0.0",
|
|
33
|
+
"@react-navigation/stack": ">=6.0.0",
|
|
37
34
|
"@umituz/react-native-design-system": "latest",
|
|
38
35
|
"@umituz/react-native-design-system-theme": "latest",
|
|
36
|
+
"@umituz/react-native-firebase-auth": "latest",
|
|
39
37
|
"@umituz/react-native-localization": "latest",
|
|
40
|
-
"@umituz/react-native-
|
|
38
|
+
"@umituz/react-native-avatar": "latest",
|
|
41
39
|
"@umituz/react-native-storage": "latest",
|
|
40
|
+
"@umituz/react-native-validation": "latest",
|
|
42
41
|
"expo-linear-gradient": ">=13.0.0",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
42
|
+
"firebase": ">=11.0.0",
|
|
43
|
+
"react": ">=18.2.0",
|
|
44
|
+
"react-native": ">=0.74.0",
|
|
45
|
+
"react-native-gesture-handler": ">=2.0.0",
|
|
46
46
|
"react-native-reanimated": ">=3.0.0",
|
|
47
|
-
"react-native-
|
|
47
|
+
"react-native-safe-area-context": ">=4.0.0",
|
|
48
|
+
"react-native-svg": ">=13.0.0",
|
|
49
|
+
"zustand": ">=4.0.0"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"@
|
|
52
|
+
"@gorhom/bottom-sheet": "^5.0.0",
|
|
51
53
|
"@types/node": "^20.0.0",
|
|
52
|
-
"
|
|
53
|
-
"react-native": "~0.76.0",
|
|
54
|
+
"@types/react": "~19.1.0",
|
|
54
55
|
"firebase": "^11.0.0",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
56
|
+
"react-native": "~0.76.0",
|
|
57
|
+
"react-native-gesture-handler": "^2.0.0",
|
|
57
58
|
"react-native-reanimated": "^3.0.0",
|
|
58
|
-
"react-native-
|
|
59
|
+
"react-native-svg": "^15.15.1",
|
|
60
|
+
"typescript": "~5.9.2",
|
|
61
|
+
"zustand": "^4.0.0"
|
|
59
62
|
},
|
|
60
63
|
"publishConfig": {
|
|
61
64
|
"access": "public"
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
9
9
|
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
10
|
+
import { Avatar } from "@umituz/react-native-avatar";
|
|
10
11
|
|
|
11
12
|
export interface ProfileSectionConfig {
|
|
12
13
|
displayName: string;
|
|
@@ -42,14 +43,7 @@ export const ProfileSection: React.FC<ProfileSectionProps> = ({
|
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
return name
|
|
47
|
-
.split(" ")
|
|
48
|
-
.map((n) => n[0])
|
|
49
|
-
.join("")
|
|
50
|
-
.toUpperCase()
|
|
51
|
-
.slice(0, 2);
|
|
52
|
-
};
|
|
46
|
+
|
|
53
47
|
|
|
54
48
|
return (
|
|
55
49
|
<TouchableOpacity
|
|
@@ -60,23 +54,13 @@ export const ProfileSection: React.FC<ProfileSectionProps> = ({
|
|
|
60
54
|
>
|
|
61
55
|
<View style={styles.content}>
|
|
62
56
|
{/* Avatar */}
|
|
63
|
-
<View
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<Text style={styles.avatarText}>
|
|
71
|
-
{getInitials(profile.displayName)}
|
|
72
|
-
</Text>
|
|
73
|
-
) : (
|
|
74
|
-
<Text
|
|
75
|
-
style={[styles.avatarText, { color: tokens.colors.onPrimary }]}
|
|
76
|
-
>
|
|
77
|
-
{getInitials(profile.displayName)}
|
|
78
|
-
</Text>
|
|
79
|
-
)}
|
|
57
|
+
<View style={styles.avatarContainer}>
|
|
58
|
+
<Avatar
|
|
59
|
+
uri={profile.avatarUrl}
|
|
60
|
+
name={profile.displayName || (profile.isAnonymous ? anonymousText : signInText)}
|
|
61
|
+
size="md"
|
|
62
|
+
shape="circle"
|
|
63
|
+
/>
|
|
80
64
|
</View>
|
|
81
65
|
|
|
82
66
|
{/* User Info */}
|
|
@@ -161,18 +145,9 @@ const styles = StyleSheet.create({
|
|
|
161
145
|
flexDirection: "row",
|
|
162
146
|
alignItems: "center",
|
|
163
147
|
},
|
|
164
|
-
|
|
165
|
-
width: 56,
|
|
166
|
-
height: 56,
|
|
167
|
-
borderRadius: 28,
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
alignItems: "center",
|
|
148
|
+
avatarContainer: {
|
|
170
149
|
marginRight: 12,
|
|
171
150
|
},
|
|
172
|
-
avatarText: {
|
|
173
|
-
fontSize: 20,
|
|
174
|
-
fontWeight: "600",
|
|
175
|
-
},
|
|
176
151
|
info: {
|
|
177
152
|
flex: 1,
|
|
178
153
|
},
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SocialLoginButtons Component
|
|
3
|
-
* Renders social sign-in buttons (Google, Apple)
|
|
4
|
-
* Configurable via props - enabled providers shown dynamically
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import React from "react";
|
|
8
2
|
import {
|
|
9
3
|
View,
|
|
@@ -16,6 +10,7 @@ import {
|
|
|
16
10
|
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
17
11
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
18
12
|
import type { SocialAuthProvider } from "../../domain/value-objects/AuthConfig";
|
|
13
|
+
import { AppleIconSvg, GoogleIconSvg } from "./icons";
|
|
19
14
|
|
|
20
15
|
export interface SocialLoginButtonsProps {
|
|
21
16
|
/** Enabled providers to display */
|
|
@@ -76,7 +71,7 @@ export const SocialLoginButtons: React.FC<SocialLoginButtonsProps> = ({
|
|
|
76
71
|
<ActivityIndicator size="small" color={tokens.colors.textPrimary} />
|
|
77
72
|
) : (
|
|
78
73
|
<>
|
|
79
|
-
<
|
|
74
|
+
<GoogleIconSvg size={20} />
|
|
80
75
|
<Text style={[styles.buttonText, { color: tokens.colors.textPrimary }]}>
|
|
81
76
|
Google
|
|
82
77
|
</Text>
|
|
@@ -100,7 +95,7 @@ export const SocialLoginButtons: React.FC<SocialLoginButtonsProps> = ({
|
|
|
100
95
|
<ActivityIndicator size="small" color={tokens.colors.textPrimary} />
|
|
101
96
|
) : (
|
|
102
97
|
<>
|
|
103
|
-
<
|
|
98
|
+
<AppleIconSvg size={20} color={tokens.colors.textPrimary} />
|
|
104
99
|
<Text style={[styles.buttonText, { color: tokens.colors.textPrimary }]}>
|
|
105
100
|
Apple
|
|
106
101
|
</Text>
|
|
@@ -113,21 +108,6 @@ export const SocialLoginButtons: React.FC<SocialLoginButtonsProps> = ({
|
|
|
113
108
|
);
|
|
114
109
|
};
|
|
115
110
|
|
|
116
|
-
/**
|
|
117
|
-
* Google Icon SVG as React Native component
|
|
118
|
-
*/
|
|
119
|
-
const GoogleIcon: React.FC = () => (
|
|
120
|
-
<View style={styles.iconContainer}>
|
|
121
|
-
<Text style={styles.googleIcon}>G</Text>
|
|
122
|
-
</View>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Apple Icon as simple text (uses SF Symbol on iOS)
|
|
127
|
-
*/
|
|
128
|
-
const AppleIcon: React.FC<{ color: string }> = ({ color }) => (
|
|
129
|
-
<Text style={[styles.appleIcon, { color }]}></Text>
|
|
130
|
-
);
|
|
131
111
|
|
|
132
112
|
const styles = StyleSheet.create({
|
|
133
113
|
container: {
|
|
@@ -167,18 +147,5 @@ const styles = StyleSheet.create({
|
|
|
167
147
|
fontSize: 16,
|
|
168
148
|
fontWeight: "600",
|
|
169
149
|
},
|
|
170
|
-
iconContainer: {
|
|
171
|
-
width: 20,
|
|
172
|
-
height: 20,
|
|
173
|
-
alignItems: "center",
|
|
174
|
-
justifyContent: "center",
|
|
175
|
-
},
|
|
176
|
-
googleIcon: {
|
|
177
|
-
fontSize: 18,
|
|
178
|
-
fontWeight: "700",
|
|
179
|
-
color: "#4285F4",
|
|
180
|
-
},
|
|
181
|
-
appleIcon: {
|
|
182
|
-
fontSize: 20,
|
|
183
|
-
},
|
|
184
150
|
});
|
|
151
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Icon SVG
|
|
3
|
+
* Dark mode compatible Apple logo
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import Svg, { Path } from "react-native-svg";
|
|
8
|
+
|
|
9
|
+
export interface AppleIconSvgProps {
|
|
10
|
+
size?: number;
|
|
11
|
+
color: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const AppleIconSvg: React.FC<AppleIconSvgProps> = ({
|
|
15
|
+
size = 20,
|
|
16
|
+
color,
|
|
17
|
+
}) => (
|
|
18
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
19
|
+
<Path
|
|
20
|
+
d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.09l-.02-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"
|
|
21
|
+
fill={color}
|
|
22
|
+
/>
|
|
23
|
+
</Svg>
|
|
24
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Icon SVG
|
|
3
|
+
* Standard Google logo with color
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import Svg, { Path } from "react-native-svg";
|
|
8
|
+
|
|
9
|
+
export interface GoogleIconSvgProps {
|
|
10
|
+
size?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const GoogleIconSvg: React.FC<GoogleIconSvgProps> = ({ size = 20 }) => (
|
|
14
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
15
|
+
<Path
|
|
16
|
+
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
17
|
+
fill="#4285F4"
|
|
18
|
+
/>
|
|
19
|
+
<Path
|
|
20
|
+
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
21
|
+
fill="#34A853"
|
|
22
|
+
/>
|
|
23
|
+
<Path
|
|
24
|
+
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
25
|
+
fill="#FBBC05"
|
|
26
|
+
/>
|
|
27
|
+
<Path
|
|
28
|
+
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
29
|
+
fill="#EA4335"
|
|
30
|
+
/>
|
|
31
|
+
</Svg>
|
|
32
|
+
);
|