mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add react-facebook-login (#14077)
* add react-facebook-login * add allowSyntheticDefaultImports * use namespace ReactFacebookLogin
This commit is contained in:
parent
0471d55976
commit
b6e2b3f577
50
react-facebook-login/index.d.ts
vendored
Normal file
50
react-facebook-login/index.d.ts
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
// Type definitions for react-facebook-login 3.4
|
||||
// Project: https://github.com/keppelen/react-facebook-login
|
||||
// Definitions by: Alexandre Paré <https://github.com/apare>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
declare namespace ReactFacebookLogin {
|
||||
|
||||
export interface ReactFacebookLoginProps {
|
||||
appId: string;
|
||||
callback: (userInfo: ReactFacebookLoginInfo) => void;
|
||||
|
||||
autoLoad?: boolean;
|
||||
buttonStyle?: React.CSSProperties;
|
||||
containerStyle?: React.CSSProperties;
|
||||
cookie?: boolean;
|
||||
cssClass?: string;
|
||||
disableMobileRedirect?: boolean;
|
||||
fields?: string;
|
||||
icon?: string | React.ReactNode;
|
||||
isDisabled?: boolean;
|
||||
language?: string;
|
||||
onClick?: () => void;
|
||||
reAuthenticate?: boolean;
|
||||
redirectUri?: string;
|
||||
scope?: string;
|
||||
size?: "small" | "medium" | "metro";
|
||||
textButton?: string;
|
||||
typeButton?: string;
|
||||
version?: string;
|
||||
xfbml?: boolean;
|
||||
}
|
||||
|
||||
export interface ReactFacebookLoginInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ReactFacebookLoginState {
|
||||
isSdkLoaded?: boolean;
|
||||
isProcessing?: boolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare class ReactFacebookLogin extends React.Component<ReactFacebookLogin.ReactFacebookLoginProps, ReactFacebookLogin.ReactFacebookLoginState> {
|
||||
}
|
||||
|
||||
export = ReactFacebookLogin;
|
||||
99
react-facebook-login/react-facebook-login-tests.tsx
Normal file
99
react-facebook-login/react-facebook-login-tests.tsx
Normal file
@ -0,0 +1,99 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
import FacebookLogin from 'react-facebook-login';
|
||||
import { ReactFacebookLoginInfo } from 'react-facebook-login';
|
||||
|
||||
const responseFacebook = (response: ReactFacebookLoginInfo) => {
|
||||
console.log(response);
|
||||
};
|
||||
|
||||
const componentClicked = () => {
|
||||
console.log("component clicked");
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
<FacebookLogin
|
||||
appId="1088597931155576"
|
||||
autoLoad={true}
|
||||
fields="name,email,picture"
|
||||
onClick={componentClicked}
|
||||
callback={responseFacebook} />,
|
||||
document.getElementById('demo')
|
||||
);
|
||||
|
||||
|
||||
ReactDOM.render(
|
||||
<FacebookLogin
|
||||
appId="1088597931155576"
|
||||
autoLoad={true}
|
||||
fields="name,email,picture"
|
||||
callback={responseFacebook}
|
||||
cssClass="my-facebook-button-class"
|
||||
icon="fa-facebook"
|
||||
/>,
|
||||
document.getElementById('demo')
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
<FacebookLogin
|
||||
appId="1088597931155576"
|
||||
autoLoad={true}
|
||||
fields="name,email,picture"
|
||||
callback={responseFacebook}
|
||||
cssClass="my-facebook-button-class"
|
||||
icon={<div className="myIcon" />}
|
||||
/>,
|
||||
document.getElementById('demo')
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
<FacebookLogin
|
||||
appId="1088597931155576"
|
||||
autoLoad={true}
|
||||
fields="name,email,picture"
|
||||
callback={responseFacebook}
|
||||
cssClass="my-facebook-button-class"
|
||||
icon={<div className="myIcon" />}
|
||||
/>,
|
||||
document.getElementById('demo')
|
||||
);
|
||||
|
||||
class MyComponent extends React.Component<any, any> {
|
||||
|
||||
private responseFacebook(response: ReactFacebookLoginInfo) {
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<FacebookLogin
|
||||
appId="1088597931155576"
|
||||
autoLoad={true}
|
||||
fields="name,email,picture"
|
||||
scope="public_profile,user_friends,user_actions.books"
|
||||
callback={responseFacebook}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyComponent2 extends React.Component<any, any> {
|
||||
|
||||
private responseFacebook(response: ReactFacebookLoginInfo) {
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<FacebookLogin
|
||||
appId="1088597931155576"
|
||||
autoLoad={true}
|
||||
fields="name,email,picture"
|
||||
callback={responseFacebook}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
22
react-facebook-login/tsconfig.json
Normal file
22
react-facebook-login/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"jsx": "react",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-facebook-login-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
react-facebook-login/tslint.json
Normal file
1
react-facebook-login/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Loading…
Reference in New Issue
Block a user