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.

[Only in Android] setAccessibilityFocus app crash

See original GitHub issue

Environment

React Native Environment Info: System: OS: macOS 10.14 CPU: (4) x64 Intel® Core™ i7-6567U CPU @ 3.30GHz Memory: 129.71 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.11.3 - /usr/local/bin/node Yarn: 1.3.2 - /usr/local/bin/yarn npm: 5.6.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 23.0.1, 25.0.0, 26.0.3, 27.0.3, 28.0.3 System Images: android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: ^16.6.1 => 16.7.0 react-native: ^0.57.5 => 0.57.8 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1 react-native-create-library: 3.0.2 react-native-git-upgrade: 0.2.7

Description

Android app crashes while using setAccessibilityFocus.

const reactTag = findNodeHandle(ref); AccessibilityInfo.setAccessibilityFocus(reactTag);

Error: E/unknown:ReactNative: Exception in native call com.facebook.react.bridge.JSApplicationIllegalArgumentException: Could not find view with tag 1135 at com.facebook.react.uimanager.NativeViewHierarchyManager.sendAccessibilityEvent(NativeViewHierarchyManager.java:843) at com.facebook.react.uimanager.UIViewOperationQueue$SendAccessibilityEvent.execute(UIViewOperationQueue.java:582) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:894) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1001) at com.facebook.react.uimanager.UIViewOperationQueue.access$2400(UIViewOperationQueue.java:46) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1061) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)

screen shot 2018-12-26 at 10 50 40 pm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Belobobrcommented, May 27, 2019

I’ve fixed it by adding <View accessible={true} />. I think react-native should provide some description for common sources of such errors. “Could not find view with tag” useless for me. This is not user friendly.

1reaction
draperunnercommented, Jan 23, 2019

It would at least be good to be able to catch the error. The following does not work, and will crash the app:

try {
    const reactTag = findNodeHandle(ref)
    AccessibilityInfo.setAccessibilityFocus(reactTag)
} catch (e) {
    // do nothing
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
React Native Weekly - W49 2021 - Andrei Calazans
This Diff fixes a crash happening as the user uses AppCompat 1.4.0 as a dependency in their App and uses a TextInput component....
Read more >
React Native setAccessibilityFocus crash - Expo Snack
(In progress) A sample codebase to demonstrate the necessary conditions for triggering a crash when using setAccessibilityFocus.
Read more >
How to disagnose why React Native app crashes only on ...
Running any react-native command now yields the same result: > npx react-native run-android variant=release error Failed to load configuration ...
Read more >
AccessibilityInfo - React Native
Set accessibility focus to a React component. On Android, this calls UIManager.sendAccessibilityEvent method with passed reactTag and UIManager.
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