Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

pushOpened auto run when receive notify #72

Closed tuantvk closed 5 years ago

tuantvk commented 5 years ago

i follow code on Integrating React Native Plugin:

DeviceEventEmitter.addListener('pushReceived', (e: Event) => {
  console.warn("pushReceived: " + JSON.stringify(e));
  // shows a push is received. Implement passive reaction to a push, such as UI update or data download.
});

// this event is fired when user clicks on notification
DeviceEventEmitter.addListener('pushOpened', (e: Event) => {
  console.warn("pushOpened: " + JSON.stringify(e));

  const { navigate } = this.props.navigation;

  if (e.userdata) {
    navigate('Screen')
    ....
  }
  // shows a user tapped the notification. Implement user interaction, such as showing push details
});

i use it in Home screen. When phone receive notify and i open it in foreground -> goto Home and direct to Notify (correct) But, when i go back Home auto run pushOpened. Why ?

// navigate to Home
        this.props
            .navigation
            .replace('Home');

Version lib i use

        "pushwoosh-react-native-plugin": "^5.15.1",
        "react": "16.6.0-alpha.8af6728",
        "react-native": "0.57.4",

Tks !

wfhm commented 5 years ago

@tuantvk,

Could you please elaborate on this issue? Which platform is affected? In which state does it happen - is the app in foreground, background or closed?

tuantvk commented 5 years ago

@wfhm i updated it

wfhm commented 5 years ago

@tuantvk I am not sure I understand the issue completely. May I ask you to provide us with a screencast for better understanding and share your device console logs describing the issue? Also, which platform is affected? Is it Android, iOS or both?

Also, i have just tested the latest plugin and all callbacks seem to work just fine when receiving notifications in both foreground and background states.

tuantvk commented 5 years ago

@wfhm Tks so much!