Conversation
Contributor
|
Can we fix this on the Android side instead? The absence of the attributed should be treated as false. |
Contributor
Contributor
Author
|
Updated this PR with an Android-side fix and regression tests covering the text-input editability and partial-update issues reproduced in #58799. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
On Android, clearing
disabledonPressableorTouchableOpacitycan leave only the child text tappable while taps on the surrounding button area fall through to its parent. This addresses the disabled-state transition reported in #56777.The native view-state setter updates
View.setEnabledonly when the accessibility state contains a non-nulldisabledfield. Clearing that field leaves the native view disabled even after JavaScript resumes press handling.Handle the reset in Android's core
ReactViewManager, including an omitted field, a null field, or a cleared state. When Fabric uses C++ prop reconciliation, include the current disabled value in accessibility-state updates for core views so a busy-only update cannot accidentally re-enable a disabled view. Reset the enabled state when recycling a view as well.The normalization applies to the core view manager. Other managers retain their existing behavior, including
TextInput, whereeditablealso controls the native enabled state. The JavaScript components are unchanged.Changelog:
[ANDROID] [FIXED] - Restore the full tap area of Pressable and TouchableOpacity when disabled is cleared.
Test Plan:
With the Android SDK, JDK 21, and Yarn v1 on the environment path:
./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest \ --tests com.facebook.react.uimanager.BaseViewManagerTest \ --tests com.facebook.react.views.textinput.ReactTextInputPropertyTest \ --tests com.facebook.react.views.view.ReactViewGroupTest \ -Preact.internal.useHermesStable=true --no-daemon --max-workers=2 \ -Dorg.gradle.jvmargs='-Xmx2g -XX:MaxMetaspaceSize=768m' --console=plainAll 60 tests pass. The three added reset/recycling cases fail before the fix and pass afterward. Coverage includes native background hit testing after clearing disabled, preserving other accessibility fields, preserving non-editable text inputs, partial updates for manager subclasses, and view recycling.
The four added C++ tests also pass in a separate macOS host harness compiling the repository's Android
HostPlatformViewProps.cppwithANDROIDandRN_SERIALIZABLE_STATEenabled. The three core-view cases fail against the original implementation and pass with this fix; the fourth checks that other component diff behavior stays unchanged. The harness usedcmake --build build -j 2followed by./build/native_disabled_props_test; this was not a full Android renderer build.Targeted Kotlin and C++ formatting checks and
git diff --checkpass. The Android API snapshot was regenerated from the compiled classes. No full application, emulator, or physical-device test was run.