@umituz/react-native-auth 1.5.0 → 1.5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-auth",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design supports Firebase Auth and can be adapted for Supabase or other providers.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -213,6 +213,9 @@ export class AuthService implements IAuthService {
213
213
  }
214
214
  }
215
215
 
216
+ // Emit event for AppNavigator to handle navigation
217
+ // DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
218
+
216
219
  return userCredential.user;
217
220
  } catch (error: any) {
218
221
  throw mapFirebaseAuthError(error);
@@ -257,6 +260,9 @@ export class AuthService implements IAuthService {
257
260
  }
258
261
  }
259
262
 
263
+ // Emit event for AppNavigator to handle navigation
264
+ // DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
265
+
260
266
  return userCredential.user;
261
267
  } catch (error: any) {
262
268
  throw mapFirebaseAuthError(error);
@@ -64,3 +64,8 @@ const styles = StyleSheet.create({
64
64
 
65
65
 
66
66
 
67
+
68
+
69
+
70
+
71
+
@@ -62,3 +62,8 @@ const styles = StyleSheet.create({
62
62
 
63
63
 
64
64
 
65
+
66
+
67
+
68
+
69
+
@@ -46,3 +46,8 @@ const styles = StyleSheet.create({
46
46
 
47
47
 
48
48
 
49
+
50
+
51
+
52
+
53
+
@@ -41,3 +41,8 @@ const styles = StyleSheet.create({
41
41
 
42
42
 
43
43
 
44
+
45
+
46
+
47
+
48
+
@@ -26,3 +26,8 @@ export const AuthGradientBackground: React.FC = () => {
26
26
 
27
27
 
28
28
 
29
+
30
+
31
+
32
+
33
+
@@ -71,3 +71,8 @@ const styles = StyleSheet.create({
71
71
 
72
72
 
73
73
 
74
+
75
+
76
+
77
+
78
+
@@ -138,3 +138,8 @@ const styles = StyleSheet.create({
138
138
 
139
139
 
140
140
 
141
+
142
+
143
+
144
+
145
+
@@ -67,3 +67,8 @@ const styles = StyleSheet.create({
67
67
 
68
68
 
69
69
 
70
+
71
+
72
+
73
+
74
+
@@ -141,7 +141,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
141
141
  t("auth.displayNamePlaceholder") || "Enter your full name"
142
142
  }
143
143
  autoCapitalize="words"
144
- editable={!loading}
144
+ disabled={loading}
145
145
  state={fieldErrors.displayName ? "error" : "default"}
146
146
  helperText={fieldErrors.displayName || undefined}
147
147
  />
@@ -155,7 +155,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
155
155
  placeholder={t("auth.emailPlaceholder")}
156
156
  keyboardType="email-address"
157
157
  autoCapitalize="none"
158
- editable={!loading}
158
+ disabled={loading}
159
159
  state={fieldErrors.email ? "error" : "default"}
160
160
  helperText={fieldErrors.email || undefined}
161
161
  />
@@ -169,7 +169,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
169
169
  placeholder={t("auth.passwordPlaceholder")}
170
170
  secureTextEntry
171
171
  autoCapitalize="none"
172
- editable={!loading}
172
+ disabled={loading}
173
173
  state={fieldErrors.password ? "error" : "default"}
174
174
  helperText={fieldErrors.password || undefined}
175
175
  />
@@ -185,7 +185,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
185
185
  }
186
186
  secureTextEntry
187
187
  autoCapitalize="none"
188
- editable={!loading}
188
+ disabled={loading}
189
189
  state={fieldErrors.confirmPassword ? "error" : "default"}
190
190
  helperText={fieldErrors.confirmPassword || undefined}
191
191
  />
@@ -61,6 +61,19 @@ export function useAuth(): UseAuthResult {
61
61
  const user = isGuest ? null : firebaseUser;
62
62
  const isAuthenticated = !!user && !isGuest;
63
63
 
64
+ // Update authStatus whenever authentication state changes
65
+ useEffect(() => {
66
+ if (firebaseLoading || loading) {
67
+ // setAuthStatus('loading'); // This line is removed
68
+ } else if (isAuthenticated) {
69
+ // setAuthStatus('authenticated'); // This line is removed
70
+ } else if (isGuest) {
71
+ // setAuthStatus('guest'); // This line is removed
72
+ } else {
73
+ // setAuthStatus('unauthenticated'); // This line is removed
74
+ }
75
+ }, [isAuthenticated, isGuest, firebaseLoading, loading]);
76
+
64
77
  // Handle analytics initialization (if callbacks are provided in config)
65
78
  useEffect(() => {
66
79
  const authChanged =
@@ -161,6 +174,7 @@ export function useAuth(): UseAuthResult {
161
174
  loading: loading || firebaseLoading,
162
175
  isGuest,
163
176
  isAuthenticated,
177
+ // authStatus, // This line is removed
164
178
  error,
165
179
  signUp,
166
180
  signIn,
@@ -81,3 +81,8 @@ export function getAuthErrorLocalizationKey(error: Error): string {
81
81
 
82
82
 
83
83
 
84
+
85
+
86
+
87
+
88
+