All Projects → corymsmith → React Native Fabric

corymsmith / React Native Fabric

Licence: mit
A React Native library for Fabric, Crashlytics and Answers

Projects that are alternatives of or similar to React Native Fabric

Fabricplugin
Fabric.io plugin for Cordova or Phonegap
Stars: ✭ 201 (-84.43%)
Mutual labels:  fabric, crashlytics
Crashlyticsdemo
Setup Fabric Crashlytics CI friendly
Stars: ✭ 142 (-89%)
Mutual labels:  fabric, crashlytics
Just Another Android App
An Android base app with loads of cool libraries/configuration NOT MAINTAINED
Stars: ✭ 1,654 (+28.12%)
Mutual labels:  fabric, crashlytics
Debt-Manager
A personal app to store people that owe you money or you owe money to. "Mo Money Mo Problems" 🎵 - The Notorious B.I.G. 😎
Stars: ✭ 22 (-98.3%)
Mutual labels:  fabric, crashlytics
Android Mvp Starter
Create/Generate your MVP projects easily
Stars: ✭ 72 (-94.42%)
Mutual labels:  crashlytics
Nativescript Plugin Firebase
🔥 NativeScript plugin for Firebase
Stars: ✭ 990 (-23.32%)
Mutual labels:  crashlytics
Beaverandfairies
Stars: ✭ 14 (-98.92%)
Mutual labels:  fabric
Sysadmintools
Acorn's Server, Workstation, & VM Cluster Automation & Documentation
Stars: ✭ 7 (-99.46%)
Mutual labels:  fabric
React Native Firebase
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Stars: ✭ 9,674 (+649.34%)
Mutual labels:  crashlytics
Libgui
Buttons & Co
Stars: ✭ 78 (-93.96%)
Mutual labels:  fabric
Web develop
《Python Web开发实战》书中源码
Stars: ✭ 1,146 (-11.23%)
Mutual labels:  fabric
Cordova Plugin Firebase
Cordova plugin for Google Firebase
Stars: ✭ 997 (-22.77%)
Mutual labels:  crashlytics
Generic django project
starting point for a new Django site (with FeinCMS, deployable on Nginx using Fabric)
Stars: ✭ 76 (-94.11%)
Mutual labels:  fabric
Fabric Sdk Java
Stars: ✭ 982 (-23.93%)
Mutual labels:  fabric
Phosphor Forge
A Forge mod designed to drastically improve the performance of Minecraft's lighting engine while fixing many bugs
Stars: ✭ 79 (-93.88%)
Mutual labels:  fabric
Neoprene
A set of Fabric tasks to deploy and administer Drupal web applications.
Stars: ✭ 12 (-99.07%)
Mutual labels:  fabric
Tis 3d
TIS-100 inspired low-tech computing in Minecraft.
Stars: ✭ 64 (-95.04%)
Mutual labels:  fabric
Streamlit Drawable Canvas
Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.
Stars: ✭ 79 (-93.88%)
Mutual labels:  fabric
Indoorjs
Indoor mapping for floorplans using on fabricjs
Stars: ✭ 59 (-95.43%)
Mutual labels:  fabric
Bigbang
Android base project used by Xmartlabs team
Stars: ✭ 47 (-96.36%)
Mutual labels:  crashlytics

react-native-fabric

A React Native library for Fabric, Crashlytics and Answers

NPM

Versioning

  • For React Native > 0.40 use version 0.5.1
  • For React Native < 0.40 use version 0.3.2

For Twitter Kit support, see react-native-fabric-twitterkit

Installation

1. Add Fabric / Crashlytics to your project

  • First, set up Fabric / Crashlytics in your app as instructed on Fabric.io. This includes downloading the fabric app and walking through the setup steps (downloading the SDK, adding it to your project and making some changes to your project).

2. Add react-native-fabric

Automatically

react-native install react-native-fabric, or with rnpm: rnpm install react-native-fabric

React Native / rnpm will automatically link all the necessary libraries for both iOS and Android.

If the installation goes off without a hitch, you can now skip to the Crashlytics Usage section or the Answers Usage section.

Manually

npm install react-native-fabric --save

  • Alternatively for Android, if you don't use Android studio you can skip the first step and instead follow the steps described in Android as well as the steps in Android without Android Studio.
Manually iOS With CocoaPods support
  • add the following line to Podfile

pod 'ReactNativeFabric', :path => '../node_modules/react-native-fabric'

Manually iOS Without CocoaPods support

Download the Crashlytics SDK and place the two frameworks in a directory called Crashlytics in the ios directory. You may want to add this directory to your .gitignore as they take up a decent amount of space and will slow down Git.

You will also need to modify the Run Script Phase that you likely added to Build Phases so that it points to the correct location for the Fabric framework. If you placed the framework directly under ios/Crashlytics as specified above,t the contents of the script will then be:

"${SRCROOT}/Crashlytics/Fabric.framework/run" API_KEY API_SECRET

Then do the following:

  • Open your project in Xcode
  • Run open node_modules/react-native-fabric/ios
  • Drag SMXCrashlytics.xcodeproj into your Libraries group
  • Select your main project in the navigator to bring up settings
  • Under Build Phases expand the Link Binary With Libraries header
  • Scroll down and click the + to add a library
  • Find and add libSMXCrashlytics.a under the Workspace group
  • ⌘+B

Android

*Note: Android support requires React Native 0.16 or later

  • Edit android/settings.gradle to look like this (without the +):

    rootProject.name = 'MyApp'
    
    include ':app'
    
    + include ':react-native-fabric'
    + project(':react-native-fabric').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fabric/android')
    
  • Edit android/app/build.gradle (note: app folder) to look like this:

    apply plugin: 'com.android.application'
    
    android {
      ...
    }
    
    dependencies {    
      compile 'com.android.support:appcompat-v7:23.0.0'
      compile 'com.facebook.react:react-native:0.19.+'
    + compile project(':react-native-fabric')
    }
    
  • RN < 0.29 - Edit your MainActivity.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):

    package com.myapp;
    
    + import com.smixx.fabric.FabricPackage;
    
    ....
    public class MainActivity extends ReactActivity {
      @Override
      protected List<ReactPackage> getPackages() {
          return Arrays.<ReactPackage>asList(
    +         new FabricPackage(),
              new MainReactPackage()
          );
      }
    }
    
  • RN 0.29+ - Edit your MainApplication.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):

    package com.myapp;
    
    + import com.smixx.fabric.FabricPackage;
    
    ....
    public class MainApplication extends Application implements ReactApplication {
      @Override
      protected List<ReactPackage> getPackages() {
          return Arrays.<ReactPackage>asList(
    +         new FabricPackage(),
              new MainReactPackage()
          );
      }
    }
    

Android without Android Studio

Make sure you also follow the steps described in Android.

  • Edit your build.gradle (note: app folder) to look like this:

    apply plugin: "com.android.application"
    
    + buildscript {
    +   repositories {
    +     maven { url 'https://maven.fabric.io/public' }
    +   }
    +   dependencies {
    +     // The Fabric Gradle plugin uses an open ended version to react
    +     // quickly to Android tooling updates
    +     classpath 'io.fabric.tools:gradle:1.+'
    +   }
    + }
    + apply plugin: 'io.fabric'
    + repositories {
    +   maven { url 'https://maven.fabric.io/public' }
    + }
    
    [...]
    
    dependencies {
        [...]
    +     compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
    +         transitive = true;
    +     }
    }
    
  • RN < 0.29 - Edit your MainActivity.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):

    + import android.os.Bundle;
    + import com.crashlytics.android.Crashlytics;
    + import io.fabric.sdk.android.Fabric;
    
    public class MainActivity extends ReactActivity {
    
    +   @Override
    +   protected void onCreate(Bundle savedInstanceState) {
    +       super.onCreate(savedInstanceState);
    +       Fabric.with(this, new Crashlytics());
    +   }
    
      [...]
    
    }
    
  • RN 0.29+ - Edit your MainApplication.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):

    + import com.crashlytics.android.Crashlytics;
    + import io.fabric.sdk.android.Fabric;
    
    public class MainApplication extends Application implements ReactApplication {
    
    +   @Override
    +   public void onCreate() {
    +       super.onCreate();
    +       Fabric.with(this, new Crashlytics());
    +   }
    
      [...]
    
    }
    
  • Note: the onCreate access privilege goes from protected to public from RN 0.28+

  • Edit your AndroidManifest.xml (in android/app/src/main/) to look like this. Make sure to enter your fabric API key after android:value=, you can find your key on your fabric organisation page.

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        [...]
        <application
          [...]
    +       <meta-data
    +         android:name="io.fabric.ApiKey"
    +         android:value=[YOUR API KEY]
    +       />
        </application>
    +   <uses-permission android:name="android.permission.INTERNET" />
    </manifest>
    

Crashlytics Usage

Note: logging will not be registered on Android to the Fabric dashboard until the app is bundled for release.

To see all available methods take a look at Crashlytics.js

var Fabric = require('react-native-fabric');

var { Crashlytics } = Fabric;

Crashlytics.setUserName('megaman');

Crashlytics.setUserEmail('[email protected]');

Crashlytics.setUserIdentifier('1234');

Crashlytics.setBool('has_posted', true);

Crashlytics.setString('organization', 'Acme. Corp');

// Forces a native crash for testing
Crashlytics.crash();

// Due to differences in primitive types between iOS and Android I've exposed a setNumber function vs. setInt, setFloat, setDouble, setLong, etc                                        
Crashlytics.setNumber('post_count', 5);

// Record a non-fatal JS error only on Android
Crashlytics.logException('');

// Record a non-fatal JS error only on iOS
Crashlytics.recordError('something went wrong!');

Answers Usage

To see all available function take a look at Answers.js

var Fabric = require('react-native-fabric');

var { Answers } = Fabric;

// All log functions take an optional object of custom attributes as the last parameter
Answers.logCustom('Performed a custom event', { bigData: true });

Answers.logContentView('To-Do Edit', 'To-Do', 'to-do-42', { userId: 93 });

Answers.logAddToCart(24.50, 'USD', 'Air Jordans', 'shoes', '987654', {color: 'red'});

Answers.logInvite('Facebook');

Answers.logLogin('Twitter', true);

Answers.logSearch('React Native');

Answers.logShare('Twitter', 'Big news article', 'post', '1234');

Answers.logSignUp('Twitter', true);

Answers.logPurchase(24.99,'USD',true, 'Air Jordans', 'shoes', '987654');


License

MIT © Cory Smith 2016

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].