Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - ReactComponentTreeHook.purgeUnmountedComponents is not a function

I get this error message when I use react-native run-ios or just build for iOS:

ReactComponentTreeHook.purgeUnmountedComponents is not a function. (In 'ReactComponentTreeHook.purgeUnountedComponents()', 'ReacComponentTreeHook.purgeUnmountedComponents' is undefined)

I have used CRNA and ejected. I have also used react-native-push-notification and react-native-beacons-manager and followed the instructions of both. The project works when I run it in Android.

I have read here that it depends on the fact that I am using the minified version of react and unminified version of react-dom but I don't see where I can change that when it comes to React Native.

How do I solve this?

like image 313
A. Savva Avatar asked Nov 17 '17 13:11

A. Savva


1 Answers

In the end, I figured that the versions of react and react-native packages that I were installed didn't "match". I saw the message npm WARN [email protected] requires a peer of [email protected] but none was installed. (I had a previous version installed because of another warning that I got).

As soon as I installed [email protected] instead, the problem was solved. Apparently facebook has removed the function ReactComponentTreeHook.purgeUnmountedComponents from the code, it is not to be used anymore.

like image 127
A. Savva Avatar answered Sep 19 '22 14:09

A. Savva