wonderpush / react-native-wonderpush

React Native based implementation for WonderPush SDK − Advanced push notification service for mobile applications and Websites. High volume, fast delivery and full-featured starting €1/month.
7 stars 1 forks source link

IOS: Deeplinking is not working when app is open #24

Open mcalc001 opened 2 years ago

mcalc001 commented 2 years ago
 const config = {
  initialRouteName: 'tabbar' 
  screens: {
    NewsArticle: {
      path: '/articles/news/:id',
    },
    VideoArticle: '/articles/video/:id',
  },
};

const linking: LinkingOptions<RootStackParamList> = {
  prefixes: ['myapp://'],

  async getInitialURL() {
    const initialUrl =
      (await Linking.getInitialURL()) || (await WonderPush.getInitialURL());
    return initialUrl;
  },

  subscribe(listener) {

    // Listen to incoming links from deep linking
    const linkingSubscription = Linking.addEventListener('url', ({ url }) => {
      listener(url);
    });

    return () => {
      // Clean up the event listeners
      linkingSubscription.remove();
    };
  },

  config: config,
};
    "react-native": "0.66.3",
    "react-native-wonderpush": "2",
    "react-native-wonderpush-fcm": "^1.0.6"

When the app is closed and a notification is received the deeplinking is working perfectly on IOS (it opens the app and navigates to the correct page). However when the app is open and receives a push notification the deeplink does not work. This is not the case on android where it works perfectly.

Above is my deeplink config.

Thankyou you for your repose.

LucasClaude commented 1 year ago

@mcalc001 did you ever figure this out? thanks! Also do you have FireBase on your project? That seems to be the issue for me.