-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Only in Android] setAccessibilityFocus app crash #22807
Comments
Can you post a demo which includes the part where you are getting a ref from a view? |
Any update ? |
It would at least be good to be able to catch the error. The following does not work, and will crash the app:
|
I was not able to catch this error while passing a valid But I do agree it could be improved to be able to catch those errors with a Promise reject. 4 different methods in NativeViewHierarchyManager.java just throw an error when a react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java Lines 841 to 843 in c974b5e
|
I believe the issue came from an invalid reactTag, so I'll close it. I do think it would be bad if your code had this issue so throwing might not be such a bad thing? Feel free to PR if you want to make it better 👍 |
I've fixed it by adding |
Environment
React Native Environment Info:
System:
OS: macOS 10.14
CPU: (4) x64 Intel(R) Core(TM) 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)
The text was updated successfully, but these errors were encountered: