🚪
🚪
🚪
🚪
Doorman
Sign In
Home
Search…
🚪
🚪
🚪
🚪
Doorman
Welcome to Doorman 👋
🥂Getting Started
Setup
Installation
Free Test Numbers
🤖Example Code
Quick Example
Example Apps & Repositories
React Navigation Example
📱Auth Components
🦁
withPhoneAuth
🔥
AuthFlow
Common Screen Props
UI Components
👓Concepts
Accessing the current user
Add user to the database
Signing out
🍬Wrappers
AuthGate
DoormanProvider
🐠React Hooks
useDoormanUser
useMaybeDoormanUser
useAuthGate
useAuthFlowState
📕Resources
Deploying to the App Store
Web Support
Custom Auth Flow
Build your UI from scratch
doorman reference
Powered By
GitBook
Signing out
To sign a user out, we use the
signOut
function returned from
withDoormanUser
or
useDoormanUser
.
For a full walkthrough of these functions, see
accessing the current user
.
Example
React Hooks
Higher Order Component
Class Components
1
import
React
from
'react'
2
import
{
Text
}
from
'react-native'
3
import
{
useDoormanUser
}
from
'react-native-doorman'
4
5
const
UserDetails
=
()
=>
{
6
const
{
signOut
}
=
useDoormanUser
()
7
8
return
<
Text
onPress
=
{
signOut
}
>
Sign Out
!
</
Text
>
9
}
10
11
export
default
UserDetails
Copied!
1
import
React
from
'react'
2
import
{
Text
}
from
'react-native'
3
import
{
withDoormanUser
}
from
'react-native-doorman'
4
5
function
UserDetails
(
props
)
{
6
// receives a user prop
7
const
{
signOut
}
=
props
.
user
8
9
return
<
Text
onPress
=
{
signOut
}
>
Sign Out
!
</
Text
>
10
}
11
12
export
default
withDoormanUser
(
UserDetails
)
Copied!
1
import
React
from
'react'
2
import
{
Text
}
from
'react-native'
3
import
{
withDoormanUser
}
from
'react-native-doorman'
4
5
class
UserDetails
extends
React
.
Component
{
6
render
()
{
7
// access via this.props.user
8
const
{
signOut
}
=
this
.
props
.
user
9
10
return
<
Text
onPress
=
{
signOut
}
>
Sign Out
!
</
Text
>
11
}
12
}
13
14
export
default
withDoormanUser
(
UserDetails
)
Copied!
withDoormanUser
and
useDoormanUser
should only be used on screens that show up
after
a user has signed in. If you use either one in a component when the user hasn't authenticated yet, it will throw an error.
Previous
User to DB code example
Next - 🍬Wrappers
AuthGate
Last modified
2yr ago
Copy link
Contents
Example