简体   繁体   中英

firebase react native throws [ReferenceError: Property 'Proxy' doesn't exist] when I try to push on reatlitme database

I'm trying to push data using react and firebase realtime database. My setup works fine for reading and updating data but it fails when I try to push.

This is the relevant section of code that fails

    try {
      const newReference = database().ref('/testUsers').push();
      console.log('Auto generated key: ', newReference.key);
    } catch (error) {
      console.log('Not able to push', error);
    }

It throws this error:

[ReferenceError: Property 'Proxy' doesn't exist]

I have managed to fix it. The demo project was the key ( https://github.com/mikehardy/rnfbdemo ) First I updated all my react native firebase dependencies to 12.1.0 but the bug was still present only in linux+android. Then I updated all the dependeties that ware common in my project with the demo project and that fixed my problem. I was using previously react 16.13.1.

before

  "dependencies": {
   ...
    "react": "16.13.1",
    "react-native": "0.63.4",
  
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },

after

  "dependencies": {
    ...
    "react": "17.0.1",
    "react-native": "0.64.2",
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1"
  },

@mikehardy Thank you so much for the help and guidance. https://github.com/invertase/react-native-firebase/issues/5503

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM