[Only in Android] setAccessibilityFocus app crash
See original GitHub issue- Use the latest React Native release: https://github.com/facebook/react-native/releases
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
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)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
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.It would at least be good to be able to catch the error. The following does not work, and will crash the app: