Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

expo-facebook

expo3.5kMIT12.2.0TypeScript support: included

Expo universal module for Facebook SDK

react-native, expo, facebook

readme

expo-facebook

Expo universal module for Facebook SDK

API documentation

Installation in managed Expo projects

For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release.

Installation in bare React Native projects

For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.

Add the package to your npm dependencies

expo install expo-facebook

Configure for iOS

Run npx pod-install after installing the npm package.

Add NSUserTrackingUsageDescription key to your Info.plist:

<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>

Add the required SKAdNetworkIdentifier items to your Info.plist: Facebook SKAdNetwork.

Finally, create a blank Swift file in your project (we recommend naming it noop-file.swift). Learn more: FBSDK blank Swift file.

Configure for Android

No additional set up necessary.

In AndroidManifest.xml, add the following element within your <application> element:

...
      <!-- The Facebook SDK runs FacebookInitProvider on startup and crashes if there isn't an ID here -->
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb0"/>
  </application>

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.

changelog

Changelog

Unpublished

🛠 Breaking changes

🎉 New features

🐛 Bug fixes

💡 Others

12.2.0 — 2022-04-18

🐛 Bug fixes

  • Fix an issue on Android that appName cannot be set with Facebook.initializeAsync(). (#16809 by @dacer)

💡 Others

⚠️ Notices

  • On Android bump compileSdkVersion to 31, targetSdkVersion to 31 and Java version to 11. (#16941 by @bbarthec)

12.1.1 - 2022-02-01

🐛 Bug fixes

  • Fix Plugin with id 'maven' not found build error from Android Gradle 7. (#16080 by @kudo)

12.1.0 — 2021-12-03

💡 Others

12.0.1 — 2021-10-01

This version does not introduce any user-facing changes.

12.0.0 — 2021-09-28

🛠 Breaking changes

🎉 New features

🐛 Bug fixes

  • logPurchaseAsync on iOS now accepts an NSNumber type, which has no user-facing impact besides fixing an error message in the App Events console. (#13369 by @cruzach)
  • Update error handler for logInWithReadPermissionsAsync to handle empty userInfo in native exception. (#14492 by @ajsmth)
  • Fix building errors from use_frameworks! in Podfile. (#14523 by @kudo)

💡 Others

  • More TypeScript doc blocks. (#13657 by @cruzach)
  • Export FacebookInitializationOptions
  • Migrated from @unimodules/core to expo-modules-core. (#13757 by @tsapeta)
  • Add correct return types to the withFacebookIOS setters. (#14423 by @Simek)
  • Updated @expo/config-plugins (#14443 by @EvanBacon)

11.2.0 — 2021-06-16

🎉 New features

🐛 Bug fixes

💡 Others

  • Removed unnecessary dependency on unimodules-constants-interface. (#12876 by @tsapeta)
  • Migrated from unimodules-permissions-interface to expo-modules-core. (#12961 by @tsapeta)
  • Build Android code using Java 8 to fix Android instrumented test build error. (#12939 by @kudo)

11.1.1 — 2021-04-20

This version does not introduce any user-facing changes.

11.1.0 — 2021-04-19

🎉 New features

11.0.5 — 2021-04-13

This version does not introduce any user-facing changes.

11.0.4 — 2021-03-31

This version does not introduce any user-facing changes.

11.0.3 — 2021-03-30

🎉 New features

11.0.2 — 2021-03-23

🎉 New features

11.0.1 — 2021-03-10

🐛 Bug fixes

11.0.0 — 2021-03-02

⚠️ Notices

🛠 Breaking changes

🎉 New features

  • Updated Android build configuration to target Android 11 (added support for Android SDK 30). (#11647 by @bbarthec)
  • Exposed setAdvertiserTrackingEnabled function to be compliant with Apple's iOS 14 tracking policy. (#11921 by @dreamolight and @tsapeta)

10.0.0 — 2021-01-15

🛠 Breaking changes

🎉 New features

9.1.0 — 2020-11-17

This version does not introduce any user-facing changes.

9.0.0 — 2020-08-18

🛠 Breaking changes

  • expo-facebook All methods and platforms now return times in JS Date objects instead of seconds. (#7101 by @evanbacon)
  • expo-facebook Error code E_CONF_ERROR has been replaced with ERR_FACEBOOK_MISCONFIGURED. (#7101 by @evanbacon)
  • expo-facebook Some instances of the error code E_NO_INIT in the client have been replaced with ERR_FACEBOOK_UNINITIALIZED. (#7101 by @evanbacon)
  • expo-facebook Some instances of the error code E_FBLOGIN_ERROR in the client have been replaced with ERR_FACEBOOK_LOGIN. (#7101 by @evanbacon)
  • initializeAsync now accepts a single argument of type FacebookInitializationOptions, previously this method accepted two arguments: appId: string & appName: string. (#7101 by @evanbacon)

🎉 New features

  • expo-facebook Added method to get Facebook authentication state. (#7101 by @evanbacon)
  • expo-facebook Added method to log out of Facebook logOutAsync(). (#7101 by @evanbacon)

8.2.1 — 2020-05-29

This version does not introduce any user-facing changes.

8.2.0 — 2020-05-27

This version does not introduce any user-facing changes.