react-native-firebase

How to correctly mock a React Native module that utilizes native code?

心不动则不痛 提交于 2019-12-11 12:47:35
问题 I'm building a React Native app with TypeScript. I'm using react-native-firebase for my notifications. I'm furthermore using Jest and Enzyme for my unit tests. I have the following wrapper function to check the users permissions: export const checkPermissions = (): Promise<boolean> => new Promise((resolve, reject) => { firebase .messaging() .hasPermission() .then(enabled => { if (enabled) { resolve(enabled); } else { firebase .messaging() .requestPermission() .then(resolve) .catch(reject); }

How can I set notification sound when app is not running in React-Native firebase

纵然是瞬间 提交于 2019-12-11 08:57:21
问题 I'm trying to make notification ringing when app is not running in IOS. Here is my code. this.notificationListener = firebase.notifications().onNotification((notification: Notification) => { // SET SYSTEM DEFAULT SOUND! notification.setSound("default"); firebase.notifications().displayNotification(notification); }); When app is in background or foreground ( Maybe I can say 'app is running'), notification rings well. Should I need to use other listener? Or should I need to add my own sound

RNFirebaseAdMobPackage throws error in react-native version 0.60.4

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 08:17:13
问题 I just upgraded my React Native application to version 0.60.4 . Here i'm trying to add react-native-firebase version ^5.2.3 and facing the following error: I have tried replacing import io.invertase.firebase.RNFirebaseAdMobPackage; With import io.invertase.firebase.RNFirebasePackage; And new RNFirebaseAdMobPackage(); With new RNFirebasePackage(); in PackageList.java . But so far no luck. What else can i do to solve the issue? 回答1: Check the settings in order. In order for Android to parse

com.android.build.api.transform.TransformException: Error while generating the main dex list

眉间皱痕 提交于 2019-12-11 06:18:08
问题 I'm implementing react-native-firebase notifications lib in a react native project. here is my android gradle.build buildscript { repositories { google() jcenter() maven { url 'https://maven.google.com/' name 'Google' } maven { url 'https://maven.fabric.io/public' } flatDir { dirs 'libs' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.google.gms:google-services:4.0.1' // NOTE: Do not place your application dependencies

How to crash a react native android app

久未见 提交于 2019-12-11 03:13:10
问题 I am working on react-native-firebase crashlytics. I am using rnfirebase starter kit. There we have crashlytics integrated with the project. Now, I want to crash my app to check the crash report. 回答1: You need to import packages react-native-fabric and another line in initial file. import Fabric from 'react-native-fabric'; var { Crashlytics } = Fabric; Crashlytics.crash(); 回答2: You need to need to import the crashlytics and use crash() to do a manual crash. import crashlytics from 'react

Bring Android React Native App to Foreground On Receipt of Data Only Firebase Cloud Message

℡╲_俬逩灬. 提交于 2019-12-10 13:58:10
问题 I am successfully using Firebase Cloud Messaging with react-native-firebase to send and receive data only messages between Android devices. When a device receives a message, if the app is in the background or has been killed I would like to bring the app to the foreground. I am getting notifications that will display a console.log() under both circumstances, but I'm having trouble figuring out how to best approach 'waking up' the app / bring it to the foreground: firebase.messaging()

Deep links in react-native-firebase notifications

余生颓废 提交于 2019-12-06 13:23:16
I am using react-native-firebase with messaging to deliver notifications to my app with cloud functions, with admin.messaging().send(message), very similar to here: https://medium.com/the-modern-development-stack/react-native-push-notifications-with-firebase-cloud-functions-74b832d45386 . I receive notifications when the app is in the background. Right now I am sending a text in the body of the notification, like 'a new location has been added to the map'. I want to be able to add some sort of deep link, so that when I swipe View on the notification (on iOS for example), it will take me to a

signInWithPhoneNumber() is not working in react-native

北城以北 提交于 2019-12-02 09:55:08
hi I am geeting this error in firebase.auth().signInWithPhoneNumber(phoneNumber) Error Domain=FIRAuthErrorDomain Code=17057 "User interaction is still ongoing, another view cannot be presented." UserInfo={NSLocalizedDescription=User interaction is still ongoing, another view cannot be presented., FIRAuthErrorUserInfoNameKey=ERROR_WEB_CONTEXT_ALREADY_PRESENTED} in RNFirebaseAuth.m. here is error const confirmResult = await firebase.auth().signInWithPhoneNumber(phoneNumber); if (confirmResult) { this.setState({ confirmResult, message: 'Code has been sent!', step: 2, }, this.goToEnterOtpScreen())

firebase cloud messaging didn't see xiaomi devices

依然范特西╮ 提交于 2019-12-01 10:32:24
问题 I'm building an react native app. I want to send cloud messages from firebase but i can't. i prepared project and install on my devices. one of them samsung other one is xiaomi. when i send notification i can see on my samsung but not xiaomi. also i can send notification my virtual android device with fcmToken. do you want how can i fix that problem? firebase cloud messagin console: https://pasteboard.co/IxyD0p3.png System: OS: Windows 10 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz

Error: RNFirebase core module was not found natively on iOS

旧街凉风 提交于 2019-11-29 11:16:06
问题 I created a new app and I am trying to use react-native-firebase . But I continually get this error: RNFirebase core module was not found natively on iOS, ensure you have correctly included the RNFirebase pod in your projects 'Podfile' and have run 'pod install'. See http://invertase.link/ios for the ios setup guide. Steps that I have done: yarn add react-native-firebase react-native link react-native-firebase Set up my .plist file from Google under .../myproject/ios/myproject Ran pod update