@umituz/react-native-auth 3.4.31 → 3.4.32

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.
@@ -1,16 +1,16 @@
1
1
  # useAuthBottomSheet
2
2
 
3
- Authentication bottom sheet yönetimi için hook. Login/Register modal'ını göstermek, yönetmek ve social authentication işlemlerini gerçekleştirmek için kullanılır.
3
+ Hook for authentication bottom sheet management. Handles login/register modal display and social authentication.
4
4
 
5
- ## Özellikler
5
+ ## Features
6
6
 
7
- - Bottom sheet modal yönetimi
8
- - Login/Register mod değiştirme
9
- - Social authentication entegrasyonu
10
- - Otomatik kapanma (başarılı authentication sonrası)
11
- - Pending callback yönetimi
7
+ - Bottom sheet modal management
8
+ - Login/Register mode switching
9
+ - Social authentication integration
10
+ - Auto-close on successful auth
11
+ - Pending callback management
12
12
 
13
- ## Kullanım
13
+ ## Usage
14
14
 
15
15
  ```typescript
16
16
  import { useAuthBottomSheet } from '@umituz/react-native-auth';
@@ -67,13 +67,13 @@ function AuthBottomSheet() {
67
67
 
68
68
  ### Parameters
69
69
 
70
- | Param | Tip | Required | Açıklama |
71
- |-------|------|----------|----------|
72
- | `socialConfig` | `SocialAuthConfiguration` | No | Social auth konfigürasyonu |
70
+ | Param | Type | Required | Description |
71
+ |-------|------|----------|-------------|
72
+ | `socialConfig` | `SocialAuthConfiguration` | No | Social auth configuration |
73
73
  | `onGoogleSignIn` | `() => Promise<void>` | No | Custom Google sign-in handler |
74
74
  | `onAppleSignIn` | `() => Promise<void>` | No | Custom Apple sign-in handler |
75
75
 
76
- #### SocialAuthConfiguration
76
+ ### SocialAuthConfiguration
77
77
 
78
78
  ```typescript
79
79
  interface SocialAuthConfiguration {
@@ -84,23 +84,23 @@ interface SocialAuthConfiguration {
84
84
 
85
85
  ### Return Value
86
86
 
87
- | Prop | Tip | Açıklama |
88
- |------|-----|----------|
89
- | `modalRef` | `RefObject<BottomSheetModalRef>` | Bottom sheet modal referansı |
90
- | `mode` | `'login' \| 'register'` | Mevcut mod |
91
- | `providers` | `SocialAuthProvider[]` | Mevcut social provider'lar |
92
- | `googleLoading` | `boolean` | Google loading durumu |
93
- | `appleLoading` | `boolean` | Apple loading durumu |
94
- | `handleDismiss` | `() => void` | Modal'ı kapatma (dismiss) |
95
- | `handleClose` | `() => void` | Modal'ı kapatma ve temizleme |
96
- | `handleNavigateToRegister` | `() => void` | Register moduna geçiş |
97
- | `handleNavigateToLogin` | `() => void` | Login moduna geçiş |
98
- | `handleGoogleSignIn` | `() => Promise<void>` | Google ile giriş |
99
- | `handleAppleSignIn` | `() => Promise<void>` | Apple ile giriş |
87
+ | Prop | Type | Description |
88
+ |------|------|-------------|
89
+ | `modalRef` | `RefObject<BottomSheetModalRef>` | Bottom sheet modal reference |
90
+ | `mode` | `'login' \| 'register'` | Current mode |
91
+ | `providers` | `SocialAuthProvider[]` | Available social providers |
92
+ | `googleLoading` | `boolean` | Google loading state |
93
+ | `appleLoading` | `boolean` | Apple loading state |
94
+ | `handleDismiss` | `() => void` | Dismiss modal |
95
+ | `handleClose` | `() => void` | Close modal and cleanup |
96
+ | `handleNavigateToRegister` | `() => void` | Switch to register mode |
97
+ | `handleNavigateToLogin` | `() => void` | Switch to login mode |
98
+ | `handleGoogleSignIn` | `() => Promise<void>` | Google sign-in handler |
99
+ | `handleAppleSignIn` | `() => Promise<void>` | Apple sign-in handler |
100
100
 
101
- ## Örnekler
101
+ ## Examples
102
102
 
103
- ### Basit Auth Bottom Sheet
103
+ ### Basic Auth Bottom Sheet
104
104
 
105
105
  ```typescript
106
106
  function AuthModal() {
@@ -117,18 +117,18 @@ function AuthModal() {
117
117
  <View>
118
118
  {mode === 'login' ? (
119
119
  <>
120
- <Text>Giriş Yap</Text>
120
+ <Text>Sign In</Text>
121
121
  <LoginForm />
122
122
  <Button onPress={handleNavigateToRegister}>
123
- Hesabınız yok mu? Kayıt Olun
123
+ Don't have an account? Sign Up
124
124
  </Button>
125
125
  </>
126
126
  ) : (
127
127
  <>
128
- <Text>Kayıt Ol</Text>
128
+ <Text>Sign Up</Text>
129
129
  <RegisterForm />
130
130
  <Button onPress={handleNavigateToLogin}>
131
- Zaten hesabınız var mı? Giriş Yapın
131
+ Already have an account? Sign In
132
132
  </Button>
133
133
  </>
134
134
  )}
@@ -138,7 +138,7 @@ function AuthModal() {
138
138
  }
139
139
  ```
140
140
 
141
- ### Social Login ile
141
+ ### With Social Login
142
142
 
143
143
  ```typescript
144
144
  function AuthBottomSheetWithSocial() {
@@ -188,7 +188,7 @@ function AuthBottomSheetWithSocial() {
188
188
  )}
189
189
 
190
190
  <Button onPress={handleNavigateToRegister}>
191
- Kayıt Ol
191
+ Sign Up
192
192
  </Button>
193
193
  </>
194
194
  ) : (
@@ -213,7 +213,7 @@ function AuthBottomSheetWithSocial() {
213
213
  )}
214
214
 
215
215
  <Button onPress={handleNavigateToLogin}>
216
- Giriş Yap
216
+ Sign In
217
217
  </Button>
218
218
  </>
219
219
  )}
@@ -231,28 +231,26 @@ function AuthBottomSheetWithCustomHandlers() {
231
231
 
232
232
  const handleCustomGoogleSignIn = async () => {
233
233
  try {
234
- // Custom Google sign-in logic
235
234
  const result = await customGoogleSignInFlow();
236
235
 
237
236
  if (result.success) {
238
- // Başarılı authentication sonrası modal otomatik kapanır
239
- console.log('Google ile giriş başarılı');
237
+ // Modal auto-closes on successful auth
238
+ console.log('Google sign-in successful');
240
239
  }
241
240
  } catch (error) {
242
- Alert.alert('Hata', 'Google ile giriş başarısız');
241
+ Alert.alert('Error', 'Google sign-in failed');
243
242
  }
244
243
  };
245
244
 
246
245
  const handleCustomAppleSignIn = async () => {
247
246
  try {
248
- // Custom Apple sign-in logic
249
247
  const result = await customAppleSignInFlow();
250
248
 
251
249
  if (result.success) {
252
- console.log('Apple ile giriş başarılı');
250
+ console.log('Apple sign-in successful');
253
251
  }
254
252
  } catch (error) {
255
- Alert.alert('Hata', 'Apple ile giriş başarısız');
253
+ Alert.alert('Error', 'Apple sign-in failed');
256
254
  }
257
255
  };
258
256
 
@@ -279,7 +277,7 @@ function AuthBottomSheetWithCustomHandlers() {
279
277
  }
280
278
  ```
281
279
 
282
- ### Auth Modal Tetikleme
280
+ ### Triggering Auth Modal
283
281
 
284
282
  ```typescript
285
283
  function RequireAuthButton() {
@@ -288,24 +286,24 @@ function RequireAuthButton() {
288
286
 
289
287
  const handlePress = () => {
290
288
  if (!isAuthenticated) {
291
- // Login modal'ını göster
289
+ // Show login modal
292
290
  showAuthModal(undefined, 'login');
293
291
  return;
294
292
  }
295
293
 
296
- // Auth gerektiren işlemi yap
297
- console.log('İşlem başarılı');
294
+ // Perform auth-required action
295
+ console.log('Action successful');
298
296
  };
299
297
 
300
298
  return (
301
299
  <Button onPress={handlePress}>
302
- Auth Gerektiren İşlem
300
+ Auth Required Action
303
301
  </Button>
304
302
  );
305
303
  }
306
304
  ```
307
305
 
308
- ### Pending Callback ile
306
+ ### With Pending Callback
309
307
 
310
308
  ```typescript
311
309
  function AddToFavoritesButton() {
@@ -314,45 +312,45 @@ function AddToFavoritesButton() {
314
312
 
315
313
  const handleAddToFavorites = async () => {
316
314
  if (!isAuthenticated) {
317
- // Authentication sonrası çalışacak callback'i kaydet
315
+ // Save callback to run after successful auth
318
316
  showAuthModal(async () => {
319
317
  await addToFavorites(postId);
320
- Alert.alert('Başarılı', 'Favorilere eklendi');
318
+ Alert.alert('Success', 'Added to favorites');
321
319
  }, 'login');
322
320
  return;
323
321
  }
324
322
 
325
- // Kullanıcı authenticated, doğrudan işlemi yap
323
+ // User authenticated, perform action directly
326
324
  await addToFavorites(postId);
327
- Alert.alert('Başarılı', 'Favorilere eklendi');
325
+ Alert.alert('Success', 'Added to favorites');
328
326
  };
329
327
 
330
328
  return (
331
329
  <Button onPress={handleAddToFavorites}>
332
- Favorilere Ekle
330
+ Add to Favorites
333
331
  </Button>
334
332
  );
335
333
  }
336
334
  ```
337
335
 
338
- ## Otomatik Kapanma
336
+ ## Auto-Close Behavior
339
337
 
340
- Hook, başarılı authentication sonrası otomatik olarak modal kapatır:
338
+ The hook automatically closes the modal after successful authentication:
341
339
 
342
- - **Authenticated olmadan authenticated olmaya**: Kullanıcı giriş yaptığında
343
- - **Anonymous'den authenticated olmaya**: Anonymous kullanıcı kayıt olduğunda
340
+ - **Not authenticated → Authenticated**: User signs in/logs in
341
+ - **Anonymous Authenticated**: Anonymous user registers
344
342
 
345
343
  ```typescript
346
- // Kullanıcı giriş yapar
347
- // → useAuth store güncellenir
348
- // → useAuthBottomSheet bunu tespit eder
349
- // → Modal otomatik kapanır
350
- // → Pending callback çalıştırılır
344
+ // User signs in
345
+ // → useAuth store updates
346
+ // → useAuthBottomSheet detects this
347
+ // → Modal auto-closes
348
+ // → Pending callback executes
351
349
  ```
352
350
 
353
- ## Provider Kontrolü
351
+ ## Provider Detection
354
352
 
355
- Hook hangi provider'ların mevcut olduğunu otomatik belirler:
353
+ The hook automatically determines which providers are available:
356
354
 
357
355
  ```typescript
358
356
  const { providers } = useAuthBottomSheet({
@@ -362,12 +360,12 @@ const { providers } = useAuthBottomSheet({
362
360
  },
363
361
  });
364
362
 
365
- // iOS: ['apple', 'google'] veya ['google']
363
+ // iOS: ['apple', 'google'] or ['google']
366
364
  // Android: ['google']
367
365
  // Web: ['google']
368
366
  ```
369
367
 
370
- ## Hata Yönetimi
368
+ ## Error Handling
371
369
 
372
370
  ```typescript
373
371
  function AuthBottomSheetWithErrorHandling() {
@@ -386,32 +384,31 @@ function AuthBottomSheetWithErrorHandling() {
386
384
  const handleGoogleSignInWithErrorHandling = async () => {
387
385
  try {
388
386
  await handleGoogleSignIn();
389
- // Hook hata yönetimini içeride yapar
390
387
  } catch (error) {
391
388
  // Additional error handling if needed
392
- Alert.alert('Hata', 'Bir sorun oluştu');
389
+ Alert.alert('Error', 'Something went wrong');
393
390
  }
394
391
  };
395
392
 
396
393
  return (
397
394
  <BottomSheetModal ref={modalRef}>
398
395
  <Button onPress={handleGoogleSignInWithErrorHandling}>
399
- Google ile Giriş
396
+ Sign in with Google
400
397
  </Button>
401
398
  </BottomSheetModal>
402
399
  );
403
400
  }
404
401
  ```
405
402
 
406
- ## İlgili Component'ler
403
+ ## Related Components
407
404
 
408
- - [`AuthBottomSheet`](../components/AuthBottomSheet.md) - Bottom sheet component'i
409
- - [`useAuthModalStore`](../stores/authModalStore.md) - Auth modal state store'u
410
- - [`LoginForm`](../components/LoginForm.md) - Login form component'i
411
- - [`RegisterForm`](../components/RegisterForm.md) - Register form component'i
405
+ - [`AuthBottomSheet`](../components/AuthBottomSheet.md) - Bottom sheet component
406
+ - [`useAuthModalStore`](../stores/authModalStore.md) - Auth modal state store
407
+ - [`LoginForm`](../components/LoginForm.md) - Login form component
408
+ - [`RegisterForm`](../components/RegisterForm.md) - Register form component
412
409
 
413
- ## İlgili Hook'lar
410
+ ## Related Hooks
414
411
 
415
- - [`useGoogleAuth`](./useSocialLogin.md#usegoogleauth) - Google auth hook'u
416
- - [`useAppleAuth`](./useSocialLogin.md#useappleauth) - Apple auth hook'u
417
- - [`useAuth`](./useAuth.md) - Ana auth state yönetimi
412
+ - [`useGoogleAuth`](./useSocialLogin.md#usegoogleauth) - Google auth hook
413
+ - [`useAppleAuth`](./useSocialLogin.md#useappleauth) - Apple auth hook
414
+ - [`useAuth`](./useAuth.md) - Main auth state management