|
1 | 1 | import { ClerkRuntimeError } from '@clerk/shared/error'; |
2 | 2 | import { useCallback, useRef } from 'react'; |
3 | | -import { Platform, StyleSheet, Text, View } from 'react-native'; |
| 3 | +import { StyleSheet, Text, View } from 'react-native'; |
4 | 4 |
|
5 | 5 | import { CLERK_CLIENT_JWT_KEY } from '../constants'; |
6 | 6 | import { getClerkInstance } from '../provider/singleton'; |
7 | 7 | import NativeClerkAuthView from '../specs/NativeClerkAuthView'; |
8 | | -import NativeClerkModule from '../specs/NativeClerkModule'; |
9 | 8 | import { tokenCache } from '../token-cache'; |
| 9 | +import { ClerkExpoModule, isNativeSupported } from '../utils/native-module'; |
10 | 10 | import type { AuthViewMode } from './AuthView.types'; |
11 | 11 |
|
12 | | -// Check if native module is supported on this platform |
13 | | -const isNativeSupported = Platform.OS === 'ios' || Platform.OS === 'android'; |
14 | | - |
15 | | -// Safely get the native module |
16 | | -let ClerkExpoModule: typeof NativeClerkModule | null = null; |
17 | | -if (isNativeSupported) { |
18 | | - try { |
19 | | - ClerkExpoModule = NativeClerkModule; |
20 | | - } catch { |
21 | | - ClerkExpoModule = null; |
22 | | - } |
23 | | -} |
24 | | - |
25 | 12 | export interface InlineAuthViewProps { |
26 | 13 | /** |
27 | 14 | * Authentication mode that determines which flows are available. |
@@ -86,7 +73,7 @@ export function InlineAuthView({ mode = 'signInOrUp', isDismissable = false }: I |
86 | 73 | if (!clerkInstance) { |
87 | 74 | throw new ClerkRuntimeError( |
88 | 75 | 'Clerk instance is not available. Ensure <ClerkProvider> is mounted before using <InlineAuthView>.', |
89 | | - { code: 'clerk_instance_not_available' }, |
| 76 | + { code: 'expo_inline_auth_view_clerk_instance_not_available' }, |
90 | 77 | ); |
91 | 78 | } |
92 | 79 |
|
|
0 commit comments