为什么只有在React Native中使用UI执行任何活动(单击/滚动)时,才从服务器获取数据?

时间:2019-05-08 20:26:54

标签: firebase react-native

我正在从Firebase实时数据库中获取数据。我在componentDidMount方法中调用该方法,当我使用UI执行某些活动时,例如-滚动或点击屏幕中的某个位置,则数据正在检索,如果不这样做,则无法在控制台中看到数据。

使用UI执行活动时,在获取数据之前会看到一行: ReactNative-SocketRocket:在调试模式下。允许连接到任何根证书

请帮助我,我过去1天卡住了表格。

我已经浏览了一些链接,但仍然没有运气。

  1. ReactNative - SocketRocket: In debug mode. Allowing connection to any root cert

  2. https://www.bountysource.com/issues/37614950-socketrocket-in-debug-mode-allowing-connection-to-any-root-cert

3。https://grokbase.com/t/gg/firebase-talk/15astfhhrv/firebase-firebase-react-native-broken

Firebase配置完成:

import Firebase from 'firebase';

const config = {
    apiKey: ",
    authDomain: "",
    databaseURL: "",
    projectId: "",
    storageBucket: "",
    messagingSenderId: ""
};
Firebase.initializeApp(config);

**依赖性:**

 "dependencies": {
    "firebase": "^5.0.3",
    "lodash": "^4.17.11",
    "prop-types": "^15.6.2",
    "react": "16.4.1",
    "react-native": "0.56.0",
    "react-native-elements": "^0.19.1",
    "react-native-firebase": "^5.3.1",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-navigation": "^2.3.0",
    "react-native-vector-icons": "^6.1.0",
    "react-redux": "^6.0.0",
    "redux": "^4.0.1"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-react-native": "5.0.2",
    "jest": "23.6.0",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }

0 个答案:

没有答案