[TIMOB-27893] Android: Setting views to "opacity: 0.0" does still trigger touch events (parity)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Unknown |
Created | 2020-05-08T19:10:35.000+0000 |
Updated | 2020-06-22T19:59:20.000+0000 |
Description
On Android, setting views to
myView.opacity = 0.0
still triggers the touch events of the view(s) that are hidden. This does not happen for iOS and is a parity issue on Android as views that are hidden should really be hidden completely.
Possible PR: https://github.com/appcelerator/titanium_mobile/pull/11695 only the visible view is returning touch events. Invisible OR touchEnabled(false) view never returns touch events. There might be an easier solution but it works :)
There is actually a practical use-case for having a transparent view to steal touch events. I've done this when creating my own custom dialogs (and overlays too). When doing this, you actually want an invisible view to fully fill the screen to steal touches around the dialog. That way, touching outside the dialog can be used to either dismiss the dialog or do nothing to force the end-user to make a selection. I think the way Android is doing it is correct. I know Windows Phone worked this way too (I've implemented a custom dialog as described above). If you don't want the invisible view to accept touches, then it's "touchEnabled" property should be set
false
.Yes, [TIMOB-26581] needs to be solved. I agree. If resolving that ticket will solve the issue for you, then I'd rather we tackle that ticket.