Auth HOC
Usage
import React from 'react';import TouchableOpacity View Text from 'react-native';import withAuth Provider as AuthProvider from 'react-native-firebase-auth-hoc'; { return <View = > <Text>JSON</Text> </View> ;} const HomeWithHOC = ; Component { return <AuthProvider = > <HomeWithHOC /> </AuthProvider> ; } ;
Provider
Reference
Props
property | description |
---|---|
onInit | Functions executed at initialization and updating of custom user information. |
onInit
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
promise | Promise | Yes | Promise to return user information to add. |
withAuth
Reference
Options
;
emailConfig?: title?: string; style?: {}; textStyle?: {}; renderButton?: Button; | null;anonymousConfig?: title?: string; style?: {}; textStyle?: {}; renderButton?: Button; | null;facebookConfig?: title?: string; style?: {}; textStyle?: {}; Promise<any>; renderButton?: Button;;googleConfig?: title?: string; style?: {}; textStyle?: {}; Promise<any>; renderButton?: Button;;logoConfig?: title?: string; style?: {}; renderLogo?: Element;;initializerConfig?: text?: string; style?: {}; duration?: number; renderInitializer?: Element;;renderLoginBackScreen?: Element;style?: {};
Property
property | description |
---|---|
user | firebase.user |
Methods
methods | description |
---|---|
signIn | Change to login status. |
signOut | Change to logout status. |
signInAnonymously | Asynchronously signs in as an anonymous user. |
signInWithFacebook | You can log in to Facebook via a promise function that returns a token. |
signInWithGoogle | You can log in to Google via a promise function that returns a token. |
createUserWithEmailAndPassword | Asynchronously signs in using an email and password. |
signIn()
;
signOut()
;
signInAnonymously()
;
signInWithFacebook()
signInWithFacebook: Promise<string> Promise<any>;
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
promise | Promise | Yes | Promise to return a Facebook token |
{ const response = await ExpoFacebook; if responsetype === 'success' return responsetoken; else throw 'Expo Error'; } ;
signInWithGoogle()
signInWithGoogle: Promise<string> Promise<any>;
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
promise | Promise | Yes | Promise to return a Google token |
{ const response = await ExpoGoogle; if responsetype === 'success' return responseaccessToken; else throw 'Expo Error'; } ;
createUserWithEmailAndPassword()
Promise<any>;
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
string | Yes | ||
password | string | Yes | password |
Support
react-navigation