From 7dfb255fdd48205e9db6e0db156a9319602682dc Mon Sep 17 00:00:00 2001 From: Salakar Date: Mon, 9 Dec 2019 13:42:24 +0000 Subject: [PATCH] docs: prettier formatting --- README.md | 89 ++++++++++++++++++++++-------------------------- docs/FIREBASE.md | 4 +-- 2 files changed, 42 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index b4c4a5637..540a765c7 100644 --- a/README.md +++ b/README.md @@ -52,19 +52,18 @@ Below are simple steps to help you get up and running. Please skip and head to t 1. Initial set-up. Import the `appleAuth` ([API documentation](docs/interfaces/_lib_index_d_.rnappleauth.module.md)) module and the `AppleButton` ([API documentation](docs/interfaces/_lib_index_d_.rnappleauth.applebuttonprops.md)) exported member element from the `@invertase/react-native-apple-authentication` library. Setup an event handler (`onPress`) to kick start the authentication request. ```js -//App.js +// App.js import React from 'react'; import { View } from 'react-native'; -import appleAuth, { AppleButton } from '@invertase/react-native-apple-authentication'; - - -async function onAppleButtonPress(){ +import { AppleButton } from '@invertase/react-native-apple-authentication'; +async function onAppleButtonPress() { + } -function App(){ - return( +function App() { + return ( { - //onCredentialRevoked returns a function that will remove the event listener. useEffect will call this function when the component unmounts +function App() { + useEffect(() => { + // onCredentialRevoked returns a function that will remove the event listener. useEffect will call this function when the component unmounts return appleAuth.onCredentialRevoked(async () => { console.warn('If this function executes, User Credentials have been Revoked'); }); - }, []);//passing in an empty array as the second argument ensures this is only ran once when component mounts initially. + }, []); // passing in an empty array as the second argument ensures this is only ran once when component mounts initially. - return( + return ( - onAppleButtonPress()} - /> + onAppleButtonPress()} /> ); } @@ -138,34 +132,31 @@ function App(){ 4. Logout user. ```js -//App.js +// App.js -import React, { useEffect } from 'react'; import { View, Button } from 'react-native'; import appleAuth, { - AppleButton, AppleAuthRequestOperation, AppleAuthCredentialState, - } from '@invertase/react-native-apple-authentication'; +} from '@invertase/react-native-apple-authentication'; -async function onLogout(){ - //performs logout request +async function onLogout() { + // performs logout request const appleAuthRequestResponse = await appleAuth.performRequest({ - requestedOperation: AppleAuthRequestOperation.LOGOUT, - }); + requestedOperation: AppleAuthRequestOperation.LOGOUT, + }); - //get current authentication state for user - const credentialState = await appleAuth - .getCredentialStateForUser(appleAuthRequestResponse.user); + // get current authentication state for user + const credentialState = await appleAuth.getCredentialStateForUser(appleAuthRequestResponse.user); - //use credentialState response to ensure the user credential's have been revoked - if (credentialState === AppleAuthCredentialState.REVOKED) { - //user is unauthenticated - } + // use credentialState response to ensure the user credential's have been revoked + if (credentialState === AppleAuthCredentialState.REVOKED) { + // user is unauthenticated + } } -function App(){ - return( +function App() { + return ( diff --git a/docs/FIREBASE.md b/docs/FIREBASE.md index e7ffdee21..8a3c3ed30 100644 --- a/docs/FIREBASE.md +++ b/docs/FIREBASE.md @@ -25,8 +25,8 @@ import { firebase } from '@react-native-firebase/auth'; import appleAuth, { AppleButton, AppleAuthRequestScope, - AppleAuthRequestOperation - } from '@invertase/react-native-apple-authentication'; + AppleAuthRequestOperation, +} from '@invertase/react-native-apple-authentication'; /** * Note the sign in request can error, e.g. if the user cancels the sign-in.