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

Prior to using this guide, please install:

Create your React Native project

A single React Native project is used for both iOS and Android development. The steps in this section create the native projects for both iOS and Android.

  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]
  4. Navigate to your new application's project folder.
  5. cd [YourApp]
  6. Install and link the Facebook SDK for React Native packages and dependencies.
  7. react-native install react-native-fbsdk
    react-native link react-native-fbsdk

    Note: If the react-native install command is not found, please update to the latest version of React Native.

Configure Your Native Project

You've 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.

For Android, there are two different sets of instructions for configuring your native project based on the version of React Native that you are using. To determine the version of React Native that is installed on your system, use the following command:

npm view react-native version

Configuration Guides

AndroidiOS