标签: react-native-firebase

如何在 React Native Firebase 上启用持久性?

我正在使用react-native-firebase并且我想确保用户在应用程序重新启动保持登录状态。现在我已经通过 hack 完成了(一旦应用程序启动,用户就会自动重新登录),但我想了解是否有更简单的方法来做到这一点。

我看到该setPersistence方法已禁用,尽管我不清楚什么是最佳选择...

react-native-firebase

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

对集合中所有文档的 Firestore 'get' 查询不返回任何文档

我有这个代码:

firebase.firestore().collection('items').get()
    .then(snapshot => {
      Alert.alert(JSON.stringify(snapshot._docs));
      snapshot.forEach(doc => {
        Alert.alert(doc.id, '=>', doc.data());
      });
    })
    .catch(err => {
      Alert.alert('Error getting documents', err);
    });
Run Code Online (Sandbox Code Playgroud)

Alert.alert(JSON.stringify(snapshot._docs))返回一个空数组-所以它没有找到任何文件。此集合中有一个文档:

在此处输入图片说明

是因为我使用电子邮件地址作为文档 ID 吗?

更新

显示我的数据库结构的其余部分的图像:

在此处输入图片说明

我正在尝试搜索PxlmyvjklhTOADngsSQguserItems(以及其他会去那里的对象)下的文档字段。

更新

这基本上就是我想要做的,只是在理论上我想使用通配符.doc(this.state.user.email)

firebase.firestore().collection('items').doc(**wildcard**).collection('userItems').where("barcode", "==", this.state.text)

但我知道这是不可能的firebase,所以我试图获取所有的items,然后在成功检索后解析它们。

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

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

React Native Firebase - 如何从 Firebase 存储中检索图像并在 Image 组件中显示?

从 firebase.storage().ref('asd') 获取图像的 ref 后,如何在此处检索图像并分配给 Image 组件?

const ref = firebase.storage().ref('path/to/image.jpg');

<Image
  source={?}
/>
Run Code Online (Sandbox Code Playgroud)

react-native react-native-firebase

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

命令失败:gradlew.bat installDebug在React-Native中安装依赖项(例如导航,firebase,图标等)时出错

每当我在我的react本机项目中安装任何依赖项时,以及每当我将link命令用于例如react-native链接react-native-gesture-handler时,这都会导致我在图1中显示错误。它没有构建项目,显示错误gradlew.bat

以下代码显示了我的package.json文件

{
  "name": "navigations",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.6.3",
    "react-native": "0.58.3",
    "react-native-gesture-handler": "^1.0.15",
    "react-navigation": "^3.0.9"
  },
  "devDependencies": {
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "24.0.0",
    "jest": "24.0.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

gradlew react-native react-navigation react-native-firebase

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

如何从Firebase存储中删除图像反应本机

我想在用户删除其帐户时删除上传到 firebase 存储的图像。我阅读了文档并尝试了他们指定的内容,但它不起作用。我回来了error error Error: No object exists at the desired reference.

\n\n

console.log 显示

\n\n

{path: "/users/w3jvGrcMJ7TSUguQRRvRa8eHEIF3/undefined", _storage: Storage}path: "/users/w3jvGrcMJ7TSUguQRRvRa8eHEIF3/undefined"_storage: Storage\xc2\xa0{_app: App, _customUrlOrRegion: undefined, namespace: "storage"}fullPath: (...)key: (...)put: (...)__proto__: ReferenceBase "ref"

\n\n

删除帐户.js

\n\n
try{\nconst user = firebase.auth().currentUser;\n    let uid = user.uid;\nlet ref = firebase.storage().ref(`/users/${uid}/`).child()\n    console.log(ref,\'ref\')  \nawait ref.delete()\n\n} catch(e){\n\nconsole.log(e)\n\n}\n
Run Code Online (Sandbox Code Playgroud)\n

reactjs react-native react-native-firebase

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

使用多个帐户 React Native Google Signin

我有一个使用谷歌登录的本机应用程序。目前,我可以使用我的手机登录的谷歌帐户之一登录,但我需要为我的谷歌帐户堆栈中的另一个谷歌帐户执行OAuth,这是为了获取 API 访问权限 我需要二级帐户的 serverAuthToken

我用于谷歌登录的库 - https://github.com/react-native-community/google-signin

到目前为止我所做的:

const firebaseGoogleLogin = async () => {
    try {
      await GoogleSignin.hasPlayServices();
      const userInfo = await GoogleSignin.signIn();
      if (userInfo) {
        await storeToken(userInfo);
        // eslint-disable-next-line no-console
        console.log('User info retrieved during login', userInfo);
      }
      // create a new firebase credential with the token
      // eslint-disable-next-line max-len
      const credential = firebase.auth.GoogleAuthProvider.credential(userInfo.idToken, userInfo.accessToken);
      // login with credential
      // eslint-disable-next-line no-unused-vars
      const firebaseUserCredential = await firebase.auth().signInWithCredential(credential);
      console.log('Logged in')
    } catch (error) {
      if (error.code === …
Run Code Online (Sandbox Code Playgroud)

android google-signin react-native-android react-native-ios react-native-firebase

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

仅在 android 中反应本机 0.62 自动链接

我正在使用使用自动链接的 react-native 0.62 我想知道是否有一种方法可以自动链接仅适用于 android 或仅适用于 ios。

我真正的问题是我使用 react-native-firebsae 和 react-native-push-notification 来发送本地通知,而我只需要为 android 使用“react-native-push-notification”。

在我添加“react-native-push-notification”并执行 pod install 后,我的 IOS 显示错误“Invarian Violation: Native module cannot be null”。先感谢您

react-native react-native-firebase react-native-push-notification

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

React Native 中的 Xcode 项目在哪里?

我试图在 React Native 中找到我的 Xcode 项目文件,以便我可以设置 React Native Firebase ( https://rnfirebase.io/docs/v5.xx/installation/ios )

但是,我找不到 Xcode 项目文件在哪里?任何人都可以帮忙。

ios firebase react-native expo react-native-firebase

0
推荐指数
1
解决办法
4705
查看次数

Firestore onSnapshot() 返回 null

我有这个代码:

 firestore()
    .collection('messages')
    .where('conversationString', '==', convString)
    .where('timestamp', '>', maxTimestamp).onSnapshot(onUpdate);
Run Code Online (Sandbox Code Playgroud)

问题是onUpdate的参数为空。

const onUpdate = async results => {
    // results is null
};
Run Code Online (Sandbox Code Playgroud)

可能是什么问题?

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

0
推荐指数
1
解决办法
1521
查看次数