customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

Linking.getInitialURL returns null when deep linking on cold start (iOS - customerio-reactnative 3.4.0) #243

Closed miguelespinoza closed 4 months ago

miguelespinoza commented 4 months ago

SDK version:

"customerio-expo-plugin": "^1.0.0-beta.15"
"customerio-reactnative": "^3.4.0"

Environment: Production. But on Development my Expo app never runs, just gets stuck on a white screen which makes it virtually impossible to debug unfortunately. This behavior only happens when I click a customer.io push notification.

Are logs available?

Unfortunately not because in Development I get a white screen

Describe the bug

Using customer.io's deep link strategy works when the app is active or in the background. It properly redirects to the correct screen.

When the app is closed/killed, the deep links stop working. There's been several reports about this, but their pretty old, so figured this could be something with the new versions. I'm not using any other third party library, like @react-native-firebase, @notifee/react-native. I do have expo-notifications, but hasn't interfered with deep links when app is opened, so can't imagine much interference when app is closed.

I should note, I'm using branch.io for deferred deep linking and it works when app is closed, so I imagine there's some data exchange issue with the customer.io SDK, could be wrong.

To Reproduce

  1. Setup customer.io with deep link support
  2. Close the app
  3. Send a customer.io push notification with a deep link.
  4. Click on the push notification, opens app, does not redirect to the screen based on the deep link

Expected behavior

When the app is closed it should redirect to the screen based on the deep link

Screenshots

Additional context

ami-aman commented 4 months ago

Hi @miguelespinoza, thanks for reaching out!

Have you tried our troubleshoot solution described here? We are aware of a deep link issue that prevents an app to open expected screen when the app is in the killed state. This is because of the lifecycle difference of native and react native platforms ! I can assist you further if this solution doesn't work for you !

miguelespinoza commented 4 months ago

@ami-aman, I figured it out. Looks like I had to pass handleDeeplinkInKilledState into the customerio-expo-plugin configuration. Unfortunately, that was not documented in the docs. Just an fyi, the docs will have to be updated for future developers.

ami-aman commented 4 months ago

I'm happy to hear you fixed the issue! 🎉

Customer.io provides a configurable property called handleDeeplinkInKilledState. When enabled, this property allows the SDK to automatically handle deep links when your app is closed or in the killed state. You can find more details about this feature in the Configure the plugin section of our documentation.

I'll go ahead and close this ticket, but feel free to reopen it if you have any further questions.