Add typings for react-facebook-login-component (#29402)

This commit is contained in:
Konstantin
2018-10-04 19:41:25 +02:00
committed by Wesley Wigham
parent 1e7ac42aa3
commit 2debc8b4cc
4 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
// Type definitions for react-facebook-login-component 4.1
// Project: https://github.com/kennetpostigo/react-facebook-login-component
// Definitions by: Konstantin Lebedev <https://github.com/koss-lebedev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
export interface FacebookLoginInfo {
id: string;
accessToken: string;
name?: string;
email?: string;
}
export interface FacebookLoginProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
socialId: string;
xfbml?: boolean;
version?: string;
fields?: string;
buttonText?: string;
responseHandler: (response: FacebookLoginInfo) => void;
}
export class FacebookLogin extends React.Component<FacebookLoginProps> {}

View File

@@ -0,0 +1,24 @@
import { FacebookLogin, FacebookLoginInfo } from "react-facebook-login-component";
import * as React from "react";
const handler = (response: FacebookLoginInfo) => {
console.log(response.accessToken);
};
const ReactFacebookLoginComponent: JSX.Element = (
<FacebookLogin
socialId="1234567890000"
responseHandler={handler}
/>
);
const ReactFacebookLoginComponentAllOptions: JSX.Element = (
<FacebookLogin
socialId="1234567890000"
responseHandler={handler}
xfbml
version="2.5"
fields="email,username"
buttonText="Sign in with Facebook"
/>
);

View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"target": "es6",
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-facebook-login-component-tests.tsx"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }