-
Notifications
You must be signed in to change notification settings - Fork 293
Fix accessibility-related crash on Android 4.x (#220). #248
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
Conversation
Hey @MarkCSmith ! Thank you for this PR. I wonder if removing a call of Any thoughts? |
I think that approach would be fine. However, my understanding is that React Native 0.64.x drops support for Android 4.x. Maybe in that case it is no longer important to fix this issue. What do you think? |
In my opinion it is always worth to support all versions, no matter if they are supported on newer RN releases. |
Avoid calling isAccessibilityFocused() on Android < Lollipop.
1f90316
to
171aff9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @MarkCSmith!
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED || | ||
(event.getEventType() == AccessibilityEvent.TYPE_VIEW_SELECTED && this.isAccessibilityFocused())) { | ||
this.setupAccessibility((int)mValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I allowed myself to rebase your changes @MarkCSmith and I adjusted them to the latest of setupAccessibility
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @BartoszKlonowski !
Avoid calling isAccessibilityFocused() on Android < Lollipop.
Summary:
Fixes issue #220.
Test Plan:
We reproduced a crash on an Android 4.1 emulator, applied this patch, and observed that the crash no longer occurred.