react-native-intercom: Error: Cannot read property 'UNREAD_CHANGE_NOTIFICATION' of undefined
After adding the line import Intercom from 'react-native-intercom'; I get the following error:

I followed all steps of the iOS installation. Could you kindly point me to the right direction?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 22 (5 by maintainers)
If you encounter this issue while testing with Jest, try this mock:
Something that works for me:
I had this because the library is not linked well, now solved.
I’m encountering this issue when I run my first jest test, I have the required lib in iOS and intercom is working just fine
Here is the output
Test suite failed to run
My test is simple
Anyone have any ideas how to fix this
Worked for me, but I had to replace genMockFn() with fn()
Thank for the all of instructions above. I still had this issue on iOS after trying everything above. The final steps that fixed the problem, for me, were:
Build your iOS project and try again.
This worked for me.
In addition to the 4 files listed above, I also added:
Adding the 6 files finally allowed me to import Intercom using
import Intercom from 'react-native-intercom'and actually call IntercomIntercom.logEvent('viewed_screen', { extra: 'metadata' })without getting any red screens.@ohtangza could you let me know how you linked the library? thanks
thanks @NSLS your post was a great help as I also had same problem and resolved (in same manner)
one thing written into the Intercom iOS installation docs, which i needed to change (my builds were failing) was the bash script path. In my app, I had dragged/dropped the Intercom.framework path directly underneath the projects root. ie per this screenshot
because of that, the path to the .sh needed to be as follows:
this might not be obvious to some so thought I’d add it in here. in reality Intercom should add a footnote to their iOS install docs about this.