Getting Started

This guide walks you through the process of using the Facebook SDK for React Native in your React Native application. The Facebook SDK for React Native is a wrapper around the Facebook SDKs for iOS and Android, allowing for Facebook integration in native apps. Access to native components, such as login and sharing, is provided entirely through documented JavaScript modules so you don't have to call native functions directly. The Facebook functionality is provided through a single NPM package so you can use it for both platforms without downloading any extra packages.

Installation

This guide assumes you have installed React Native and its dependencies, including but not limited to:

  • Node, Yarn, and the React Native CLI.
  • Your target platform IDE: Android Studio for Android, Xcode for iOS.

If you do not have an existing React Native application, you can generate a new project using the React Native CLI:

  1. Open up a terminal window and navigate to the folder where you would like to store your project.
  2. Create your React Native application by typing the following command in to your terminal window. Replace [YourApp] with the name of your application.
  3. react-native init [YourApp]

Note: If you have an existing React Native project, please upgrade react-native to version 0.60 or newer before proceeding.

Install the React Native Facebook SDK

  1. Open up a terminal window and navigate to the folder where your application is stored, then run yarn to install JavaScript packages.

  2. cd [YourApp]
    yarn

    Note: You may run npm install in place of yarn, if using npm.

  3. Install and link the React Native Facebook SDK package and dependencies.

  4. yarn add react-native-fbsdk
    react-native link react-native-fbsdk

    Note: You may run npm install in place of yarn add, if using npm.

Configure Your Project

You have installed the Facebook SDK for React Native, but you must now perform some additional steps to install and configure the native project for each application platform. Use the guides below to configure the projects for your desired platforms.

Android

Configuration Guide for Android

iOS

Configuration Guide for iOS