react-native-fb-like-button

0.0.1 • Public • Published

react-native-fb-like-button

An component for react-native.

Add it to your project

  1. Run npm install react-native-fb-like-button --save
  2. Make sure to follow all 7 steps here first: https://developers.facebook.com/docs/ios/getting-started#xcode. You don't have to download the SDKs Frameworks, they are in this npm package, just drag them into your project from finder.
  3. Open your project in XCode, right click on Libraries and click Add Files to "Your Project Name" then add FbLikeButtonView.xcodeproj to your project.
  4. Add libFbLikeButtonView.a to Build Phases -> Link Binary With Libraries
  5. Whenever you want to use it within React code now you can: var FbLikeButton = require('react-native-fb-like-button').FbLikeButton;

Usage

// Within your render function:
<FbLikeButton objectID="https://developers.facebook.com"/>

If you need to listen for the an event when the user likes the object, add this listener in your

  componentDidMount() {
    DeviceEventEmitter.addListener(
      'FbLiked',
      (data) => {
        console.log('FbLiked!', data);
      }
    );
    DeviceEventEmitter.addListener(
      'FbUnliked',
      (data) => {
        console.log('FbUnliked!', data);
      }
    );
  }

MIT Licensed

Package Sidebar

Install

npm i react-native-fb-like-button

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • kdmny