react-native-sdk
react-native-sdk copied to clipboard
Can't fetch HTML content when using inAppHandler callback
Hi Iterable team,
When trying to fetch HTML content using IterableSDK.inAppManager.getHtmlContentForMessage
called from within IterableConfig's inAppHandler
callback, i get an error message that says the message could not be found and apparently the messageId from this message cannot be found in any of the message fetched via getMessages()
call as well.
Error: Could not find message with id: <messageId>
Versions: "@iterable/react-native-sdk": "^1.3.13", "react-native": "0.72.10",
Have the same issue. What worked for me is that I fetch html content in inAppHandler
after a setTimeout with 0 interval.
Looks like some race condition
config.inAppHandler = (message: IterableInAppMessage) => {
Iterable.inAppManager.getHtmlContentForMessage(message).catch(() => {
// here will be error
})
setTimeout(() => Iterable.inAppManager.getHtmlContentForMessage(message).then(() => {
// here won't be error
}), 0)
return IterableInAppShowResponse.skip
}