-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathApp.tsx
More file actions
53 lines (45 loc) · 1.2 KB
/
App.tsx
File metadata and controls
53 lines (45 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { TurnkeyProvider } from '@turnkey/sdk-react-native';
import {
SafeAreaView,
useColorScheme,
Text,
} from 'react-native';
import {
Colors,
} from 'react-native/Libraries/NewAppScreen';
import { TurnkeyCallbackProvider } from './TurnkeyCallbackProvider';
export const TurnkeyProviderComponent = ({ children }: { children: React.ReactNode }) => {
const sessionConfig = {
apiBaseUrl: 'TURNKEY_API_URL',
organizationId: 'TURNKEY_PARENT_ORG_ID',
onSessionSelected: () => {
console.log("onSessionSelected");
},
onSessionCleared: () => {
console.log("onSessionCleared");
},
};
return (
<TurnkeyProvider config={sessionConfig}>
<TurnkeyCallbackProvider>
{children}
</TurnkeyCallbackProvider>
</TurnkeyProvider>
);
};
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
return (
<TurnkeyProviderComponent>
<SafeAreaView style={backgroundStyle}>
<Text>
Welcome to Turnkey React Native!
</Text>
</SafeAreaView>
</TurnkeyProviderComponent>
);
}
export default App;