[react-twitter-auth] update types (#27680)

* Add missing props

* Add more tests

* Update types version

* Fix specified type version for package

* Fix specified version
This commit is contained in:
Dmitriy Savchenko 2018-08-06 21:35:26 +03:00 committed by Sheetal Nandi
parent 953faadd23
commit 686d449242
2 changed files with 46 additions and 12 deletions

View File

@ -1,6 +1,7 @@
// Type definitions for react-twitter-auth 0.0
// Project: https://github.com/GenFirst/react-twitter-auth
// Definitions by: Paul Fasola <https://github.com/paulfasola>
// Dmytro Savchenko <https://github.com/loginwashere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -17,6 +18,9 @@ interface TwitterLoginProps {
dialogHeight?: number;
showIcon?: boolean;
credentials?: "omit" | "same-origin" | "include";
customHeaders?: HeadersInit;
children?: React.ReactNode;
forceLogin?: boolean;
}
declare var TwitterLogin: React.StatelessComponent<TwitterLoginProps>;

View File

@ -6,17 +6,47 @@ const ReactTwitterAuth: React.StatelessComponent = () => {
function handleFailure(msg: string) {}
return (
<TwitterLogin loginUrl="http://server.url/api/v1/auth/twitter"
onSuccess={ handleSucess }
onFailure={ handleFailure }
requestTokenUrl="http://server.url/api/v1/auth/twitter/reverse"
dialogWidth={ 1200 }
dialogHeight={ 800 }
style={{display: "initial"}}
disabled={ false }
text={ "test" }
tag="button"
credentials="same-origin"
showIcon={true}/>
<div>
<TwitterLogin
loginUrl="http://server.url/api/v1/auth/twitter"
onSuccess={ handleSucess }
onFailure={ handleFailure }
requestTokenUrl="http://server.url/api/v1/auth/twitter/reverse"
/>
<TwitterLogin
loginUrl="http://server.url/api/v1/auth/twitter"
onSuccess={ handleSucess }
onFailure={ handleFailure }
requestTokenUrl="http://server.url/api/v1/auth/twitter/reverse"
dialogWidth={ 1200 }
dialogHeight={ 800 }
style={{display: "initial"}}
disabled={ false }
text={ "test" }
tag="button"
credentials="same-origin"
showIcon={true}
/>
<TwitterLogin
loginUrl="http://server.url/api/v1/auth/twitter"
onSuccess={ handleSucess }
onFailure={ handleFailure }
requestTokenUrl="http://server.url/api/v1/auth/twitter/reverse"
dialogWidth={ 1200 }
dialogHeight={ 800 }
style={{display: "initial"}}
disabled={ false }
text={ "test" }
tag="button"
credentials="same-origin"
showIcon={true}
customHeaders={{
authorization: 'Bearer sometoken',
}}
forceLogin={true}
>
Login with twitter
</TwitterLogin>
</div>
);
};