Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android not working. #21

Closed
peachlsy opened this issue Jul 14, 2019 · 5 comments · Fixed by #24
Closed

Android not working. #21

peachlsy opened this issue Jul 14, 2019 · 5 comments · Fixed by #24
Labels
critical Critical bug

Comments

@peachlsy
Copy link

Hi, thank you for your contribution of this library. It works perfect on iOS, but it seems like nothing happened in android emulator after this.pop.show()

Thank you!

@carsonwah
Copy link
Owner

Hi @peachlsy , could you provide more details for further investigation? Such as:

emulator: (android studio/geny motion)
device: (samsung, ...)
android version:
react native version:
react-native-push-notification-popup version:
etc

@peachlsy
Copy link
Author

Hi @carsonwah
Thank you for your reply. Here are my environment:
emulator: android studio
device: pixel 3
android version: API 28, Android 9.0(Google APIs)
CPU: x86
react native version: 0.59.8
react-native-push-notification-popup version: ^1.3.0

Thanks!

@martin9908
Copy link

Hi Carson,
I'm also experiencing the same issue on my physical device. I'm using a
Device: Xiaomi Redmi Note 3
react-native version: 0.33.0
react-native-push-notification-popup version: ^1.3.0

@carsonwah carsonwah added the critical Critical bug label Jul 26, 2019
@sungsong88
Copy link
Contributor

sungsong88 commented Aug 16, 2019

Hey guys. I had the same issue and I fixed my issue just by switching the order.

What I used to have based on README.md

  ...
  render() {
    const { navigation } = this.props;

    return (
      <View style={{ flex: 1 }}>
        <NotificationPopup ref={popup => this.popup = popup} />
        <SwitchNavigator navigation={navigation} />
      </View>
    );
  }
}

What I have now:

  ...
  render() {
    const { navigation } = this.props;

    return (
      <View style={{ flex: 1 }}>
        <SwitchNavigator navigation={navigation} />
        <NotificationPopup ref={popup => this.popup = popup} />
      </View>
    );
  }
}

Just by switching the order of my Navigator and the NotificationPopup, the popup is now showing for Android.(And of course works fine for iOS)

If this fixed your issue. I think we can ask @carsonwah to update the README's example code.

@carsonwah
Copy link
Owner

carsonwah commented Aug 31, 2019

Hi guys, sorry for the late reply.

We are currently using zIndex to display the popup at the front of the scrren. It works well on iOS, but causes issues on Android.

Related discussions:

Solution 1

Add elevation to popupContainer component. But this may introduces some unwanted styles.

Solution 2

From Official Doc on zIndex:

Normally, you don't use zIndex. Components render according to their order in the document tree, so later components draw over earlier ones.

So as a workaround, maybe we can remove the use of zIndex completely, and make sure users use the component in correct order in the render method.

I will try that soon. Any comment or pull request is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical Critical bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants