Created
May 14, 2019 19:45
-
-
Save dabit3/6c4f0a06b5e39fd53567a4a521143efa to your computer and use it in GitHub Desktop.
Example of manual sign out using React Native & AWS Amplify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { View, Text } from 'react-native' | |
| import { withAuthenticator } from 'aws-amplify-react-native' | |
| function App(props) { | |
| function signOut() { | |
| Auth.signOut() | |
| .then(() => { | |
| props.onStateChange('signedOut', null); | |
| }) | |
| .catch(err => { | |
| console.log('err: ', err) | |
| }) | |
| } | |
| return ( | |
| <View> | |
| <Text>Hello World</Text> | |
| <Text onPress={signOut}>Sign Out</Text> | |
| </View> | |
| ) | |
| } | |
| export default withAuthenticator(App) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not seem to work for react. Is it only for react native?