Home

Awesome

react-native-mapintent

A React Native intent for Android Facebook App.

Installation

npm install --save react-native-fbintent

Add it to your android project

...
include ':RNFbIntent', ':app'
project(':RNFbIntent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbintent')
...
dependencies {
    ...
    compile project(':RNFbIntent')
}
import com.syarul.fbintent.RNFbIntentPackage;  // <--- import

public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  ......

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);

    mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .addPackage(new MainReactPackage())
      .addPackage(new RNFbIntentPackage())              // <------ add here
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "ExampleRN", null);

    setContentView(mReactRootView);
  }

  ......

}

Example

FbIntent.open(facebook_page_id)

Example:

var FbIntent = require('react-native-fbintent');

FbIntent.open('461828740557560');

License

MIT