-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathApp.tsx
More file actions
38 lines (31 loc) · 1.22 KB
/
App.tsx
File metadata and controls
38 lines (31 loc) · 1.22 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
import React, {useEffect, useState} from 'react';
import {StatusBar, Text} from 'react-native';
import Purchases from 'react-native-purchases';
import {API_KEY} from './src/constants';
import Navigation from './src/navigation/Navigation';
import {SafeAreaProvider} from 'react-native-safe-area-context';
function App(): React.JSX.Element {
const [isReady, setIsReady] = useState(false);
useEffect(() => {
/* Enable debug logs before calling `setup`. */
Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
/*
Initialize the RevenueCat Purchases SDK.
- appUserID is null, so an anonymous ID will be generated automatically by the Purchases SDK. Read more about Identifying Users here: https://docs.revenuecat.com/docs/user-ids
- useAmazon is false, so it will use the Play Store in Android and App Store in iOS by default.
*/
if (API_KEY) {
Purchases.configure({apiKey: API_KEY, appUserID: null, useAmazon: false});
setIsReady(true);
} else {
console.error('API_KEY is not set');
}
}, []);
return (
<SafeAreaProvider>
<StatusBar barStyle="light-content" />
{isReady ? <Navigation /> : <Text>Loading...</Text>}
</SafeAreaProvider>
);
}
export default App;