DefinitelyTyped/types/react-native-google-signin/index.d.ts
Tanguy Krotoff 4abbfb42ff [react-native] Switch to *real* components + rename Properties to Props (#25307)
* Switch from var to const

* import React instead of /// <reference types="react" />

* Fix TextInput and remove TextInputStatic

See #16318 [react-native] Wrong type for component ref

* Remove TextStatic

* Remove ActivityIndicatorStatic

* Remove ActivityIndicatorIOSStatic

* Remove DatePickerIOSStatic

* Remove DrawerLayoutAndroidStatic

* Remove ImageStatic

* Remove ImageBackgroundStatic

* Remove InputAccessoryViewStatic

* Remove ListViewStatic

* Remove MapViewStatic

* Remove MaskedViewStatic

* Remove ModalStatic

* Remove NavigatorIOSStatic

* Remove PickerStatic

* Remove PickerIOSStatic

* Remove ProgressBarAndroidStatic

* Remove ProgressViewIOSStatic

* Remove RefreshControlStatic

* Remove RecyclerViewBackedScrollViewStatic

* Remove SafeAreaViewStatic

* Remove SegmentedControlIOSStatic

* Remove SliderStatic

* Remove StatusBarStatic

* Remove ScrollViewStatic

* Remove SnapshotViewIOSStatic

* Remove SwipeableListViewStatic

* Remove SwitchStatic

* Remove SwitchIOSStatic

* Remove TabBarIOSStatic

* Remove ToolbarAndroidStatic

* Remove TouchableHighlightStatic

* Remove TouchableNativeFeedbackStatic

* Remove TouchableOpacityStatic

* Remove TouchableWithoutFeedbackStatic

* Remove ViewStatic

* Remove ViewPagerAndroidStatic

* Remove WebViewStatic

* Remove ButtonStatic

* Remove ClippingRectangleStatic, GroupStatic, ShapeStatic, SurfaceStatic, ARTTextStatic, ARTTextStatic

* Remove KeyboardAvoidingViewStatic

* Remove FlatListStatic

* Rename TextProperties and friends to *Props

* Rename TextInputProperties and friends to *Props

* Rename WebViewProperties and friends to *Props

* Rename *Properties to *Props

* Rename ScrollViewProperties and friends to *Props

* Improve DatePickerAndroid.open()

* Rename ImagePropertiesSourceOptions to ImageSourcePropType

* Rename MaskedViewProps to MaskedViewIOSProps

* Rename PointProperties to PointPropType

* Rename TabBarItem to TabBarIOSItem

* Remove internal *Properties

* ImagePropertiesSourceOptions => ImagePropsSourceOptions

* Merge fail: react-native-linear-gradient has been removed

* Rename ImageProperties to ImageProps

* Update authors list

* Remove ImagePropsSourceOptions

* Move *Properties redirections to legacy-properties.d.ts
2018-04-26 10:30:30 -07:00

147 lines
3.6 KiB
TypeScript

// Type definitions for react-native-google-signin 0.12
// Project: https://github.com/devfd/react-native-google-signin
// Definitions by: Jacob Froman <https://github.com/j-fro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
import { ViewProps } from 'react-native';
export interface GoogleSigninButtonProps extends ViewProps {
size?: GoogleSigninButton.Size;
color?: GoogleSigninButton.Color;
onPress?(): void;
}
export class GoogleSigninButton extends React.Component<GoogleSigninButtonProps> {
constructor(props: GoogleSigninButtonProps);
}
export namespace GoogleSigninButton {
enum Size {
Standard,
Wide,
Icon
}
enum Color {
Light,
Dark
}
}
export interface HasPlayServicesParams {
/**
* When autoresolve is true, the user will be prompted to install Play
* Services if on Android and they are not installed.
*/
autoResolve?: boolean;
}
export interface ConfigureParams {
/**
* The Google API scopes to request access to. Default is email and profile.
*/
scopes?: string[];
/**
* iOS client ID from Developer Console. Required for iOS.
*/
iosClientId?: string;
/**
* Web client ID from Developer Console. Required for offline access
*/
webClientId?: string;
/**
* Must be true if you wish to access user APIs on behalf of the user from
* your own server
*/
offlineAccess?: boolean;
/**
* Specifies a hosted domain restriction
*/
hostedDomain?: string;
/**
* ANDROID ONLY. Specifies if the consent prompt should be shown at each login.
*/
forceConsentPrompt?: boolean;
/**
* ANDROID ONLY. An account name that should be prioritized.
*/
accountName?: string;
}
export interface User {
id: string | null;
name: string | null;
email: string | null;
scopes?: string[];
photo: string | null;
familyName: string | null;
givenName: string | null;
idToken: string | null;
/**
* IOS ONLY. Use getAccessToken() on Android
*/
accessToken: string;
/**
* IOS ONLY. Use getAccessToken() on Android
*/
accessTokenExpirationDate: number;
/**
* Not null only if a valid webClientId and offlineAccess: true was
* specified in configure().
*/
serverAuthCode: string | null;
}
export namespace GoogleSignin {
/**
* Check if the device has Google Play Services installed. Always resolves
* true on iOS
*/
function hasPlayServices(params?: HasPlayServicesParams): Promise<boolean>;
/**
* Configures the library for login. MUST be called before attempting login
*/
function configure(params?: ConfigureParams): Promise<void>;
/**
* Returns the current signed in user, or null if not signed in.
*/
function currentUser(): User | null;
/**
* Returns a Promise that resolves with the current signed in user, or null
* if not signed in.
*/
function currentUserAsync(): Promise<User | null>;
/**
* Prompts the user to sign in with their Google account. Resolves with the
* user if successful.
*/
function signIn(): Promise<User>;
/**
* Signs the user out.
*/
function signOut(): Promise<void>;
/**
* ANDROID ONLY. Resolves with the current signed in user's access token.
*/
function getAccessToken(): Promise<string | null>;
/**
* Removes your application from the user's authorized applications
*/
function revokeAccess(): Promise<void>;
}