Skip to content

kdmny/react-native-fb-like-button

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

An <FbLikeButton> component for react-native.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published