1 |
|
2 |
|
3 | import { NativeModules } from 'react-native';
|
4 |
|
5 | const { ExponentFacebook } = NativeModules;
|
6 |
|
7 | type FacebookLoginResult = {
|
8 | type: string,
|
9 | token?: string,
|
10 | expires?: number,
|
11 | };
|
12 |
|
13 | type FacebookOptions = {
|
14 | permissions?: Array<string>,
|
15 | behavior?: 'web' | 'native' | 'browser' | 'system',
|
16 | };
|
17 |
|
18 | export 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 | };
|