@umituz/react-native-auth 1.6.7 → 1.6.8

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.6.7",
3
+ "version": "1.6.8",
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",
@@ -112,7 +112,7 @@ export function useAuth(): UseAuthResult {
112
112
 
113
113
  // Listen for guest-mode-enabled event to update state
114
114
  useEffect(() => {
115
- const subscription = DeviceEventEmitter.addListener(
115
+ const guestSubscription = DeviceEventEmitter.addListener(
116
116
  "guest-mode-enabled",
117
117
  () => {
118
118
  /* eslint-disable-next-line no-console */
@@ -123,10 +123,26 @@ export function useAuth(): UseAuthResult {
123
123
  }
124
124
  );
125
125
 
126
+ // Listen for user-authenticated event to ensure state updates
127
+ const authSubscription = DeviceEventEmitter.addListener(
128
+ "user-authenticated",
129
+ () => {
130
+ /* eslint-disable-next-line no-console */
131
+ if (__DEV__) {
132
+ console.log("[useAuth] User authenticated event received");
133
+ }
134
+ // Clear guest mode if set
135
+ if (isGuest) {
136
+ setIsGuest(false);
137
+ }
138
+ }
139
+ );
140
+
126
141
  return () => {
127
- subscription.remove();
142
+ guestSubscription.remove();
143
+ authSubscription.remove();
128
144
  };
129
- }, []);
145
+ }, [isGuest]);
130
146
 
131
147
  const signUp = useCallback(async (
132
148
  email: string,