Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase initial error with React Native (Cannot read property 'getItem' of undefined)

I am developing a mobile app with React native and trying to use firebase as a database. Yesterday I tried to upgrade my React native version from 0.37 to 0.40 but some files conflicted and my app didnt start. So I reverted to version 0.37. ( I copy pasted conflicted files with my earliest copies to solve this)

Now, when I copy paste firebase code snippet to my App.js file to setup firebase, I get an error "Cannot read property 'getItem' of undefined"

If I remove firebase snippet everything works fine. Otherwise after 1-2 seconds red screen pops up with the error on attachments.

enter image description here

I am suspecting, I broke something on the way to reverting react native 0.37. I tried to uninstall and reinstall firebase with no avail. Now I am beating my head and any help would be greatly appreaciated.

like image 287
Şükrü Yıldızel Avatar asked Jan 29 '17 10:01

Şükrü Yıldızel


1 Answers

I found a solution to my problem. It seems that problem is not with firebase but its because of chrome debugger. Having the 'device toggle toolbar' (CMD SHIFT M) enabled in chrome seems to be causing the problem. De-selecting 'device toggle toolbar' and reloading the emulator gets rid of the error.

enter image description here

Check the image link for sample please.

like image 196
Şükrü Yıldızel Avatar answered Oct 21 '22 11:10

Şükrü Yıldızel