npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-firebase-crash-report

v1.3.0

Published

React Native Firebase Crash Report

Downloads

36

Readme

React Native Firebase Crash Report

npm version npm downloads

React Native Firebase Crash Report With Custom Log

Version

If you're using React Native >= 0.40, make sure to use react-native-firebase-crash-report >= 1.2.0

Usage


import FirebaseCrash from 'react-native-firebase-crash-report';

/*
 * Create custom log messages that will be included in the crash report
 */

FirebaseCrash.log('User logged in');

/*
 * Create custom log messages that will be included in the crash report and output to logcat/NSLog
 */

FirebaseCrash.logcat('User logged in');

// Android only
// Params:
// - message: string, required
// - debug level: int, optional, default 3 (https://developer.android.com/reference/android/util/Log.html)
// - tag: string, optional, default 'RNFirebaseCrashReport'
FirebaseCrash.logcat('User logged in', 3, 'MyTag');

/*
 * Report errors on demand
 *
 * iOS Note: calling this API on iOS will result in app crash
 */

FirebaseCrash.report('A weird thing just happened...');

Installation

Install node module

npm install --save react-native-firebase-crash-report

Linking libraries

rnpm link react-native-firebase-crash-report

iOS Configuration

Install Firebase From Cocoapods

For more information please visit Set Up Crash Reporting For iOS

Pre-check

If you are using RN < 0.29 you would have run into this problem, just follow the PR to fix it manually.

Go to your project's ios folder

cd <your_project>/ios

(Optional) Initialise Pod

Note: You can skip this step if you have pod initialised already.

pod init

Add pod 'Firebase/Core' and pod 'Firebase/Crash' to Podfile

 target 'YourProject' do
   # Uncomment this line if you're using Swift or would like to use dynamic frameworks
   use_frameworks!

   # Pods for YourProject
+  pod 'Firebase/Core'
+  pod 'Firebase/Crash'

   target 'YourProjectTests' do
     inherit! :search_paths
     # Pods for testing
   end

 end

Install Pods

pod install

Initialise Firebase

Add following code in your AppDelegate.m

 #import "AppDelegate.h"

 #import "RCTRootView.h"

+@import Firebase;

 @implementation AppDelegate

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {

   ...

   self.window.rootViewController = rootViewController;
   [self.window makeKeyAndVisible];
+
+  // Use Firebase library to configure APIs
+  [FIRApp configure];
+
   return YES;
 }

Android Configuration

For more information please visit Set Up Crash Reporting For Android

Upgrade Google Play Services and Google Repository

Upgrade Google Play Services and Google Repository

Add Google Services

  • In android/build.gradle
     dependencies {
         classpath 'com.android.tools.build:gradle:1.3.1'
         classpath 'de.undercouch:gradle-download-task:2.0.0'
+        classpath 'com.google.gms:google-services:3.0.0'
  • In android/app/build.gradle, add this line at the bottom of the file
apply plugin: 'com.google.gms.google-services'

(Optional) Manually linking libraries

  • app/build.gradle
dependencies {
  ...
  compile project(':react-native-firebase-analytics')
  compile project(':react-native-firebase-crash-report') <-- add this
  ...
}
  • settings.gradle
include ':react-native-firebase-analytics'
project(':react-native-firebase-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-analytics/android')

// add everything below this
include ':react-native-firebase-crash-report'
project(':react-native-firebase-crash-report').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-crash-report/android')
  • MainApplication.java
...
import com.ianlin.RNFirebaseCrashReport.RNFirebaseCrashReportPackage; <-- add this
...

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new FIRAnalyticsPackage(),
    ...
    new RNFirebaseCrashReportPackage(), <-- add this
    ...
  );
}

Contributing

Any pull requests, issue reports and suggestion are highly welcome.

License

ISC License (functionality equivalent to MIT License)