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

Fix for android 11 #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Makiwin
Copy link

@Makiwin Makiwin commented Jul 1, 2021

In Android 11 getView is deprecated and return null, i managed this to avoid the application crash

@souly1
Copy link

souly1 commented Sep 6, 2021

is this going in @EddyVerbruggen ?

@yzhan94
Copy link

yzhan94 commented Oct 26, 2021

Hi,

This PR makes my app unresponsive after showing the Toast.
Tested on an API30 emulator, I believe the issue is that the following condition makes it so that the onTouch listener is never removed when Toast.getView is null, and it always is in API > 29:

// if getview is not null so mostRecentToast.getView().isShown() i can execute old code
f (mostRecentToast.getView() != null) {
  getViewGroup().setOnTouchListener(null);
  return true;
}else {
  // getView null notify the touch event
  return returnTapEvent("touch", msg, data, callbackContext);
}

It should instead always remove the onTouch listener as long as the mostRecentToast is null, while maintaining the getView call for API < 30:

if (mostRecentToast == null || (mostRecentToast.getView() != null && !mostRecentToast.getView().isShown())) {
  getViewGroup().setOnTouchListener(null);
  return false;
}

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

Successfully merging this pull request may close these issues.

None yet

3 participants