question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] - Crashes when any accessiblity is used

See original GitHub issue

I am using RN 0.61

When the most basic view is used with any accessibility service enabled on the Android device, the app crashes, with the following stack trace:

2020-12-09 11:32:55.375 15655-15655/com.petrooutlet.supersonic E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.petrooutlet.supersonic, PID: 15655
    java.lang.IllegalArgumentException: parameter must be a descendant of this view
        at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:5459)
        at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:5388)
        at android.view.ViewGroup$ViewLocationHolder.init(ViewGroup.java:7885)
        at android.view.ViewGroup$ViewLocationHolder.obtain(ViewGroup.java:7819)
        at android.view.ViewGroup$ChildListForAccessibility.init(ViewGroup.java:7754)
        at android.view.ViewGroup$ChildListForAccessibility.obtain(ViewGroup.java:7722)
        at android.view.ViewGroup.addChildrenForAccessibility(ViewGroup.java:1978)
        at android.view.ViewGroup.addChildrenForAccessibility(ViewGroup.java:1987)
        at android.view.ViewGroup.addChildrenForAccessibility(ViewGroup.java:1987)
        at android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal(ViewGroup.java:3076)
        at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6609)
        at android.view.View.createAccessibilityNodeInfoInternal(View.java:6568)
        at android.view.View.createAccessibilityNodeInfo(View.java:6553)
        at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:145)
        at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:119)
        at android.view.View.onInitializeAccessibilityEventInternal(View.java:6505)
        at android.view.View.onInitializeAccessibilityEvent(View.java:6493)
        at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:6358)
        at android.view.View.sendAccessibilityEventUnchecked(View.java:6343)
        at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.run(ViewRootImpl.java:7479)
        at android.os.Handler.handleCallback(Handler.java:755)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6141)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)

The basic version being used for testing:

EXPO SDK 39, Bare Workflow

import React from "react"
import { View, StyleSheet, Text } from "react-native"
import ExternalDisplay, {
  useExternalDisplay,
} from "react-native-external-display"

const CustomerFacingDisplay = () => {
  const screens = useExternalDisplay()

  return (
    <ExternalDisplay
      mainScreenStyle={{ flex: 1 }}
      fallbackInMainScreen={true}
      screen={Object.keys(screens)[0]}
    >
      <View style={{ backgroundColor: "brown", flex: 1, flexDirection: "row" }}>
        <Text>Hello!</Text>
      </View>
    </ExternalDisplay>
  )
}

export default CustomerFacingDisplay

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
husseinmcommented, Dec 12, 2020

It appears adding the below code to RNExternalDisplayView works!


import java.util.ArrayList;

...

  @Override
  public void addChildrenForAccessibility(ArrayList<View> outChildren) {
    // Explicitly override this to prevent accessibility events being passed down to children
    // Those will be handled by the mHostView which lives in the dialog
  }
1reaction
husseinmcommented, Dec 12, 2020

The PR has been made, if you could @jhen0409 , please accept and bump up the version/publish to master.

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessibility Settings Crashes | XDA Forums
I "upgraded" to Android 11 and, among the myriad of other issues, I can't open accessibility settings at all. The ROM is stock,...
Read more >
Android - accessibility crashes - JUCE Forum
We always appreciate crash reports! Hi @ed95, I've rolled-out that update - just this morning. Alas, the app is still crashing.
Read more >
app crashes when using accessibility service #75 - GitHub
This occures if an accessible service is active that uses the following info: https://developer.android.com/reference/android/a...
Read more >
Android Accessibility Keeps Turning Off Accountable2You
Open your Settings app, search for "Accessibility", and tap Accessibility in the results. · Next, tap one of these three buttons (the button...
Read more >
Crash with enabled accessibility when sorting ViewGroup ...
With enabled accessibility a ViewGroup in some cases a crash will occur since IllegalArgumentException might be thrown by merge sort. The crash happen...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found