UNPKG

807 BJavaScriptView Raw
1// @flow
2
3import { NativeModules } from 'react-native';
4
5const { ExponentFacebook } = NativeModules;
6
7type FacebookLoginResult = {
8 type: string,
9 token?: string,
10 expires?: number,
11};
12
13type FacebookOptions = {
14 permissions?: Array<string>,
15 behavior?: 'web' | 'native' | 'browser' | 'system',
16};
17
18export default {
19 async logInWithReadPermissionsAsync(
20 appId: string,
21 options?: FacebookOptions
22 ): Promise<FacebookLoginResult> {
23 if (typeof appId !== 'string') {
24 console.warn(
25 `logInWithReadPermissionsAsync: parameter 'appId' must be a string, was '${typeof appId}''.`
26 );
27 appId = String(appId);
28 }
29
30 if (!options || typeof options !== 'object') {
31 options = {};
32 }
33 return ExponentFacebook.logInWithReadPermissionsAsync(appId, options);
34 },
35};