Skip to main content
The LoginButton component is a pre-built UI component that initiates Facebook Login or Logout when pressed. It automatically shows the appropriate button based on the user’s login state.

Import

Props

permissions

The permissions to request when the login button is pressed.
Type: Array<string>
Default: ['public_profile']
Platform: Both

Example

Common Permissions

  • public_profile - Basic profile information (name, profile picture)
  • email - User’s email address
  • user_friends - List of friends who use your app
  • user_birthday - User’s birthday
  • user_photos - User’s photos
  • user_posts - User’s posts

onLoginFinished

Callback invoked when login completes, fails, or is cancelled.
Type: Function
Platform: Both

Parameters

LoginResult:

Example


onLogoutFinished

Callback invoked when logout completes.
Type: Function
Platform: Both

Example


loginTrackingIOS

The desired tracking preference for iOS login. Use 'limited' for Limited Login (privacy-focused) or 'enabled' for traditional login.
Type: 'enabled' | 'limited'
Default: 'enabled'
Platform: iOS only
iOS 14.5+ requires Limited Login when users opt out of App Tracking Transparency. Setting this to 'limited' ensures your app works for all users.

Example


nonceIOS

An optional nonce to use for iOS login validation. A unique nonce is automatically generated if not provided.
Type: string
Platform: iOS only
The nonce must be a non-empty string without whitespace. Invalid nonces will be ignored.

Example


loginBehaviorAndroid

The behavior to use when attempting login on Android.
Type: 'native_with_fallback' | 'native_only' | 'web_only'
Default: 'native_with_fallback'
Platform: Android only
  • 'native_with_fallback' - Try Facebook app, fall back to web dialog
  • 'native_only' - Only use Facebook app
  • 'web_only' - Only use web dialog

Example


defaultAudience

The default audience for posts made by the application.
Type: 'friends' | 'everyone' | 'only_me'
Default: 'friends'
Platform: Both
  • 'friends' - Only friends can see posts
  • 'everyone' - All Facebook users can see posts
  • 'only_me' - Only the user can see posts

Example


tooltipBehaviorIOS

The desired tooltip behavior for iOS.
Type: 'auto' | 'force_display' | 'disable'
Default: 'auto'
Platform: iOS only
  • 'auto' - Show tooltip automatically based on Facebook’s logic
  • 'force_display' - Always show the tooltip
  • 'disable' - Never show the tooltip

Example


style

Custom styling for the button.
Type: ViewStyle
Platform: Both
The default button size is 190x30. You can customize the size, but the button content (text and icon) is controlled by Facebook and cannot be changed.

Example


testID

Test identifier for automated testing.
Type: string
Platform: Both

Example

Complete Example

See Also

Login Methods

Learn about different login methods

LoginManager

Programmatic login with LoginManager

Limited Login

Understand iOS Limited Login

AccessToken

Work with access tokens