标签: react-native-firebase

react-native-firebase安装-包io.invertase.firebase不存在吗?

在我的项目中运行“ react-native run-android”时,出现以下问题。我已经按照正常情况经历了react-native-firebase,但是在这种情况下,我不太清楚自己做错了什么?

:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/source/myapp/android/app/src/main/java/com/gctodo/MainApplication.java:11: error: package io.invertase.firebase does not exist
import io.invertase.firebase.RNFirebasePackage;
                            ^
/source/myapp/android/app/src/main/java/com/gctodo/MainApplication.java:12: error: package io.invertase.firebase.auth does not exist
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
                                 ^
/source/myapp/android/app/src/main/java/com/gctodo/MainApplication.java:13: error: package io.invertase.firebase.firestore does not exist
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
                                      ^
/source/myapp/android/app/src/main/java/com/gctodo/MainApplication.java:30: error: cannot find symbol
          new RNFirebasePackage(),
              ^
  symbol: class RNFirebasePackage
/source/myapp/android/app/src/main/java/com/gctodo/MainApplication.java:31: error: cannot find symbol
          new RNFirebaseAuthPackage(),
              ^
  symbol: class RNFirebaseAuthPackage
/source/myapp/android/app/src/main/java/com/gctodo/MainApplication.java:32: error: cannot find symbol
          new RNFirebaseFirestorePackage()
              ^
  symbol: …
Run Code Online (Sandbox Code Playgroud)

react-native-firebase

6
推荐指数
1
解决办法
7001
查看次数

如何结合Firestore orderBy和startAfter光标

我正在尝试查询Firestore中的列表,该列表应按降序日期属性排序,并使用startAfter游标对结果进行分页。

正如您在下面的代码片段中看到的那样,一旦我将orderBy('date','desc')与startAfter(lastDoc.date)合并,此操作就会失败。

我想知道我在做什么错。有任何想法吗?

// this actually works
// but it is sorted by ascending dates
db.collection('tanks')
  .doc(tankId)
  .collection('documentations')
  .orderBy('date')
  .startAfter(lastDoc.date)
  .limit(pageSize)
  .get()
  
// this even works...
// but has no cursor (startAfter) set for pagination
db.collection('tanks')
  .doc(tankId)
  .collection('documentations')
  .orderBy('date', 'desc')
  .limit(pageSize)
  .get()
  
// this is what i need
// but it returns always zero results
db.collection('tanks')
  .doc(tankId)
  .collection('documentations')
  .orderBy('date', 'desc')
  .startAfter(lastDoc.date)
  .limit(pageSize)
  .get()
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-cloud-firestore react-native-firebase

6
推荐指数
2
解决办法
7343
查看次数

react-native-firebase:如何在注销时删除令牌?

一旦用户退出,我想停止接收应用程序的通知。我想我必须删除 react-native-firebase 生成的设备令牌,但我找不到任何功能来执行此操作。

有谁知道如何做到这一点?

react-native react-native-firebase

6
推荐指数
2
解决办法
4306
查看次数

在某些设备中未显示React本机Firebase通知提示

嗨,我正在使用react native firebase进行通知,我成功集成了它,并且两种平台的通知都来了,但是当应用程序处于前台或后台时,对于Android的提示并没有到来。我阅读了与此有关的所有问题,但没有任何线索。

应用环境:

所以当应用程序在前台应用程序时,需要处理我正在做的通知:

componentDidMount() {
    this.checkFirebase();
  }

  registerFbCloudMessagingListener = () => {
    firebase.notifications().onNotification(notification => {
      if (Platform.OS === "android") {
        notification.android.setChannelId("forgroundnotification");
      }
      firebase.notifications().displayNotification(notification);
    });
  };
  async checkFirebase() {
    const enabled = await firebase.messaging().hasPermission();
    if (enabled) {
      // user has permissions
      this.registerFbCloudMessagingListener();
    } else {
      // user doesn't have permission
      this.requestFbPermission();
    }
  }

  async requestFbPermission() {
    try {
      let permission = await …
Run Code Online (Sandbox Code Playgroud)

android firebase react-native firebase-cloud-messaging react-native-firebase

6
推荐指数
1
解决办法
2436
查看次数

导入Firebase后的本机错误

我已经firebase使用cmd在我的项目中安装了软件包

npm install --save firebase 
Run Code Online (Sandbox Code Playgroud)

当我将firebase导入我的react-native项目时import firebase from 'firebase',出现此错误。可能是什么问题呢? 在此处输入图片说明

firebase react-native-firebase

6
推荐指数
1
解决办法
1676
查看次数

如何通过额外的身份验证参数进行Firestore规则身份验证(React-Native)?

我想在我的应用程序中实现基于角色的限制。我在一个收集文档中有用户角色信息。现在,我想编写规则以限制对数据库的其他集合进行不同的写入,更新操作。

因为我将Firestore数据库与React-Native一起使用,所以我在插入/更新时仅传递了相应集合的文档信息。因此,我该如何传递用户的角色信息,以使我的规则得到认证,并且数据不会进入其他集合。

描述上述情况的一个示例:

/collection1/document1
{
   prop1: value1,
   prop2: value2,
   role: "WRITE"
}

/collection1/document2
{
   prop1: value1,
   prop2: value2,
   role: "READ"
}
Run Code Online (Sandbox Code Playgroud)

现在考虑当前登录的用户是document2

我还有另一个收藏:

/collection2/doc1
{
   userRef: document1, //this is id of document1 from collection1
   ...
}
Run Code Online (Sandbox Code Playgroud)

我想为collection2配置firestore规则,即如果请求来自用户,role="WRITE"则只允许它发布/更新文档。

阅读了许多文章和方法,但是其中任何一个都不满足该用例。

任何帮助,将不胜感激。

firebase react-native google-cloud-firestore react-native-firebase

6
推荐指数
1
解决办法
488
查看次数

React Native Firebase Social Auth 在发布时不起作用

所以,我的应用程序已经在 Google Play 上,突然间我的社交身份验证不再起作用了。它在调试时运行良好,当我在终端上运行 --variant=release 时,但在内部测试中从商店下载 apk 时它不起作用。我们已经在多部手机上进行了测试。

电子邮件登录工作正常,只有谷歌身份验证不起作用。Logcat 不显示任何内容。我按下谷歌按钮,提示打开,我选择用户,但没有任何反应。同样,这只会在我从google play下载后发生。会是什么呢?

我们正在使用 react-native-firebase 和 react-native-google-signin。

我在这个问题上浪费了整整一周的时间,我想不出原因。

应用程序/build.gradle

apply plugin: "com.android.application"
apply plugin: 'io.fabric'


import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development …
Run Code Online (Sandbox Code Playgroud)

react-native firebase-authentication react-native-firebase

6
推荐指数
2
解决办法
1770
查看次数

react-native-firebase Crashlytics 不报告崩溃

我已经在我的应用程序中使用 Fabric Crashlytics 一段时间了,使用react-native-fabric. 现在我想使用react-native-firebase执行 JS 堆栈映射的实现。去年,我将我的应用(Release 和 Staging 版本、Android 和 iOS)迁移到我的 Firebase 控制台,因此我能够在那里和 Fabric 仪表板上看到我的崩溃报告。

我已按照以下步骤进行迁移,当我执行 crashlytics().crash() 并重新启动应用程序时,崩溃报告未将其发送到 iOS 或 android 上的仪表板。首先,我像这样删除了 react-native-fabric 。

  1. 删除 app/build.gradle、app/settings.gradle 和 MainApplication.java 中对结构的引用
  2. 已删除 android/app/fabric.properties
  3. 从中删除 ApiKey AndroidManifest.xml
  4. 从 iOS 构建中删除 Crashlytics 和 Fabric 框架。
  5. 删除结构运行脚本构建阶段
  6. 在 AppDelegate.m 中删除对结构的引用
  7. yarn 删除 react-native-fabric 并从 JS 代码中的 react-native-fabric 中删除导入。
  8. 从 Info.plist 中删除 Fabric API 密钥(我直到后来才发现这样做的建议)
  9. 删除 Fabric.app 和相关文件。

(上述某些更改是由 自动完成的react-native unlink react-native-fabric。)

然后我将我的应用程序从 RN 0.59 升级到 0.61.4。

然后我react-native-firefase …

react-native-firebase

6
推荐指数
1
解决办法
1936
查看次数

在前台显示通知 React Native Firebase v6

我正在使用最新的react native版本0.62和最新版本的react-native-firebase ie v6。我能够收到通知,它在后台工作正常,但不显示在前台。

这是屏幕截图: 在此输入图像描述

这是我的代码:

checkPermission = async () => {
    const enabled = await messaging().hasPermission();
    console.log('enabled ******* ',enabled)
    if (enabled) {
      this.getFcmToken();
    } else {
      this.requestPermission();
    }
  };

  getFcmToken = async () => {
    const fcmToken = await messaging().getToken();
    if (fcmToken) {
      console.log('Your Firebase Token is:', fcmToken);
      // this.showAlert('Your Firebase Token is:', fcmToken);
    } else {
      console.log('Failed', 'No token received');
    }
  };

  requestPermission = async () => {
    try {
      await messaging().requestPermission();
      // User has authorised
    } catch …
Run Code Online (Sandbox Code Playgroud)

javascript android push-notification react-native react-native-firebase

6
推荐指数
1
解决办法
8011
查看次数

无法查看 Firebase Analytics 调试视图 React Native

我已经学习了多个教程并阅读了多个 Stackoverflow 帖子,但无论我做什么,我都无法使用 RNFireBase 在我的 iOS 应用程序的 DebugView 中显示任何内容。我真的很感激这方面的一些帮助。我已经失去了几天试图弄清楚这一点,但我不知道出了什么问题。我在模拟器和物理设备上都尝试过,但都没有运气。

我在 XCode 的控制台中收到日志消息,但在 Firebase 控制台中没有显示任何内容。以下是我在使用事件时在本地收到的消息:

反应本机

<TouchableOpacity
  onPress={() =>
    analytics().logSelectContent({
      content_type: "clothing",
      item_id: "abcd",
    })
  }
>
  <Text>Log message</Text>
</TouchableOpacity>;
Run Code Online (Sandbox Code Playgroud)

日志

2020-05-15 12:22:26.486761-0400 Example App[23464:8820959] 6.13.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: app, select_content, {
    content_type = clothing;
    ga_event_origin (_o) = app;
    ga_screen_class (_sc) = UIViewController;
    ga_screen_id (_si) = -3307323385789565728;
    item_id = abcd;
}
2020-05-15 12:22:26.487676-0400 Example App[23464:8820959] 6.13.0 - [Firebase/Analytics][I-ACS023073] Debug mode is enabled. Marking event as debug and …
Run Code Online (Sandbox Code Playgroud)

ios firebase react-native firebase-analytics react-native-firebase

6
推荐指数
1
解决办法
3676
查看次数