kirgudkov/react-native-in-app-message

[Android] Can't press in-app message

Closed this issue · 8 comments

Hey, and thanks for this great package.

While on iOS it is functioning perfectly, on Android trying to press the Notification doesn't work, it ends up pressing other buttons underneath.

I'm using a custom component, but tried without it and the same happens. Already tried setting zIndex on both the Notification component and my custom one.

@thiagobrez Hi! Have you installed react-native-gesture-handler properly?

And did you add the following at the top of your entry file, such as index.js or App.js:

import 'react-native-gesture-handler' ?

Yeah, I guess... just double-checked.

There isn't anything complicated in the react-native-gesture-handler installation right? Installed and added those lines to MainActivity.java. And yes, I'm importing the library in index.js.

Please, check my example. Maybe it will help :)

Just ran it - works great. Added some logs to see that handlers work

@KirillGudkov Yeah, I'm messing around with your example and it works flawlessly. Trying to replicate the same on my structure but the issue persists.

A few more notes:

  • I can interact with the Notification (like holding and pulling down) but pressing just passes through
  • In your example you're not importing react-native-gesture-handler (?)

Just found out that placing the Notification elsewhere worked. The problem is that I wanted them at the top of my navigators, like in the examples. But why is this a problem only on Android?

Possible conflicts that I've been thinking:

  • Maybe it's because I have buttons on my header?
  • Something with react-navigation possibly?

Yeah, usage section provides an example with navigator, if You placed the Notification like that - it should work)

The notification is absolutely positioned and should be above the navigator in the view hierarchy (but below it in the code)

App.js

...
  <AppNavigator />
  <Notification />
...

Why does it work on iOS? idk. Gesture handler is a native thing, it works differently on both platforms. On iOS, this is based on a ResponderChain, I guess .. it can pass touches through view hierarchy if there is no any handlers until it will be handled. In Android this is not possible, because of layout specifics I guess.

I don't know how it actually works)

If there are no questions anymore, please close the issue.

Oh, placing Notification below in the code did the trick! I think you should make this explicit in the readme.

Thanks for your help and attention.

I had the same problem.
I tried using the workaround for the issue, but it didn't work for me, I found out about PanGestureHandle.
Found this issue, and this solution worked for me.
I was a fool.

software-mansion/react-native-gesture-handler#516