Howdy!
We're experiencing this issue after updating from 3.x SDK to 4.0.1 (https://github.com/intercom/intercom-react-native
react-native version: 0.70.5
Code sample (which is basically the same that you have in docs):
useEffect(() => {
const subscription = Intercom.addEventListener(
IntercomEvents.IntercomUnreadCountDidChange,
(response) => {
setCount(response.count);
}
);
return () => {
try {
subscription.remove();
} catch (e) {
console.log(e);
}
};
}, []);
Calling subscription.remove on line 11 during effect cleanup triggers an exception.
Line 13 prints:
[RangeError: Maximum call stack size exceeded]
Without try/catch block the call just fails silently due to this - https://github.com/facebook/react-native/issues/32673(which doesn't contribute to the original problem, just makes it go unnoticed).
Let me know what other details you might need.
What can be done about it? Thanks.