Search code examples
iosreact-nativeintercom

React Native Intercom - Invariant Violation


I am using react-native-intercom to manage Intercom in my app. I have installed the Intercom iOS SDK using CocoaPods, and linked the react-native-intercom manually (didn't work when using react-native link). Problem though is when I insert it into a container, then I am getting the error message when it loads:

Invariant Violation: Element type is invalid: expected a string (for built-in component) or a class/function (for composite components) but got: object.

However, if I then dismiss the error, Intercom shows up fine e.g. if I have:

componentWillMount () {
    Intercom.displayConversationsList()
}

Then after dismissing the error, my messages would appear and it would work, so I'm guessing the installation and linking are okay. I've tried doing a clean npm install, but same thing happens, won't load without the error.

My render just looks like this as I'm just testing it on a blank page:

  render () {
    return (
      <View>
        <Intercom />
      </View>
    )
  }

I'm actually just assuming that this is how you call Intercom inside a render, as I couldn't find any examples.


Solution

  • Just remove the <Intercom /> component.