Skip to content

[Android] delaysChildPressedState={false} does nothing in a minified release build #4652

Open

Description

@YevheniiKotyrlo

Description

On Android, delaysChildPressedState={false} (#4308) has no effect in a release build that R8 minifies, such as the example app's, whose prebuild-generated gradle.properties sets android.enableMinifyInReleaseBuilds=true. A Touchable in that ScrollView still enters its pressed state only after the tap timeout, or on release for a quick tap, exactly like one in a ScrollView that keeps the delay. The same build with minification off honors the option.

NativeViewGestureHandler finds React Native's HasChildPressedStateDelay.setHasChildPressedStateDelay by reflection (NativeViewGestureHandler.kt#L331-L355). R8 renames the interface and keeps none of its methods, since only reflection reaches them: the build's mapping has com.facebook.react.uimanager.HasChildPressedStateDelay -> g12: with no members under it, while the views keep setHasChildPressedStateDelay. So getMethod throws, the setter stays null, and the option is a no-op. gesture-handler ships no ProGuard rule that keeps the interface.

Once the option takes effect, every tap on a button in a keyboardShouldPersistTaps="never" scroll view with the keyboard up is dropped and leaves the keyboard up, which is #4653.

Steps to reproduce

  1. Render the gist's component, [Native] Add delaysChildPressedState to native gesture #4308's test plan with onPressIn and onPressOut logged, in the example app and build it in release, minified as its gradle.properties sets it.
  2. Tap the left square (delaysChildPressedState={false}) with adb shell input tap <x> <y>: onPressIn and onPressOut arrive in the same millisecond, and adb logcat -d holds Can't cancel already finished gesture, on 5 of 5 taps, as on the right square, which keeps the delay.
  3. Hold the left square for 400 ms with adb shell input swipe <x> <y> <x> <y> 400: onPressOut follows onPressIn by 298 to 316 ms, as on the right square (243 to 317 ms).
  4. Build again with -Pandroid.enableMinifyInReleaseBuilds=false and repeat: a quick tap on the left square leaves no warning, on 5 of 5 taps, and on a 400 ms hold onPressOut follows onPressIn by 406 to 421 ms. The right square reads as before.

Expected in steps 2 and 3: the left square as in step 4.

Actual: in the minified build the left square times its press like the right one, which keeps the delay. The probe's output, the minified build first:

Five quick taps and five 400 ms holds on each square, minified and unminified, on the API 34 emulator at main b19e233
#### review-delays-child-pressed-state-b19e23310
soft keyboard after opening: hidden
undelayed-touchable at 50 138
quick tap on undelayed-touchable, attempt 1: onPressIn to onPressOut 0 ms, warnings 1
quick tap on undelayed-touchable, attempt 2: onPressIn to onPressOut 0 ms, warnings 1
quick tap on undelayed-touchable, attempt 3: onPressIn to onPressOut 0 ms, warnings 1
quick tap on undelayed-touchable, attempt 4: onPressIn to onPressOut 0 ms, warnings 1
quick tap on undelayed-touchable, attempt 5: onPressIn to onPressOut 0 ms, warnings 1
400ms tap on undelayed-touchable, attempt 1: onPressIn to onPressOut 316 ms, warnings 0
400ms tap on undelayed-touchable, attempt 2: onPressIn to onPressOut 316 ms, warnings 0
400ms tap on undelayed-touchable, attempt 3: onPressIn to onPressOut 322 ms, warnings 0
400ms tap on undelayed-touchable, attempt 4: onPressIn to onPressOut 323 ms, warnings 0
400ms tap on undelayed-touchable, attempt 5: onPressIn to onPressOut 316 ms, warnings 0
delayed-touchable at 210 138
quick tap on delayed-touchable, attempt 1: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 2: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 3: onPressIn to onPressOut 1 ms, warnings 1
quick tap on delayed-touchable, attempt 4: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 5: onPressIn to onPressOut 10 ms, warnings 1
400ms tap on delayed-touchable, attempt 1: onPressIn to onPressOut 316 ms, warnings 0
400ms tap on delayed-touchable, attempt 2: onPressIn to onPressOut 280 ms, warnings 0
400ms tap on delayed-touchable, attempt 3: onPressIn to onPressOut 313 ms, warnings 0
400ms tap on delayed-touchable, attempt 4: onPressIn to onPressOut 315 ms, warnings 0
400ms tap on delayed-touchable, attempt 5: onPressIn to onPressOut 317 ms, warnings 0
#### review-delays-child-pressed-state-b19e23310-unminified
soft keyboard after opening: hidden
undelayed-touchable at 50 138
quick tap on undelayed-touchable, attempt 1: onPressIn to onPressOut 1 ms, warnings 0
quick tap on undelayed-touchable, attempt 2: onPressIn to onPressOut 0 ms, warnings 0
quick tap on undelayed-touchable, attempt 3: onPressIn to onPressOut 0 ms, warnings 0
quick tap on undelayed-touchable, attempt 4: onPressIn to onPressOut 16 ms, warnings 0
quick tap on undelayed-touchable, attempt 5: onPressIn to onPressOut 1 ms, warnings 0
400ms tap on undelayed-touchable, attempt 1: onPressIn to onPressOut 399 ms, warnings 0
400ms tap on undelayed-touchable, attempt 2: onPressIn to onPressOut 418 ms, warnings 0
400ms tap on undelayed-touchable, attempt 3: onPressIn to onPressOut 416 ms, warnings 0
400ms tap on undelayed-touchable, attempt 4: onPressIn to onPressOut 417 ms, warnings 0
400ms tap on undelayed-touchable, attempt 5: onPressIn to onPressOut 416 ms, warnings 0
delayed-touchable at 210 138
quick tap on delayed-touchable, attempt 1: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 2: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 3: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 4: onPressIn to onPressOut 0 ms, warnings 1
quick tap on delayed-touchable, attempt 5: onPressIn to onPressOut 0 ms, warnings 1
400ms tap on delayed-touchable, attempt 1: onPressIn to onPressOut 316 ms, warnings 0
400ms tap on delayed-touchable, attempt 2: onPressIn to onPressOut 299 ms, warnings 0
400ms tap on delayed-touchable, attempt 3: onPressIn to onPressOut 316 ms, warnings 0
400ms tap on delayed-touchable, attempt 4: onPressIn to onPressOut 317 ms, warnings 0
400ms tap on delayed-touchable, attempt 5: onPressIn to onPressOut 316 ms, warnings 0

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

https://gist.github.com/YevheniiKotyrlo/249ea819c31b2c35fdbf66ff3006d0af

Gesture Handler version

main at b19e233

React Native version

0.88.0

Platforms

Android

JavaScript runtime

Hermes

Workflow

Using Expo Prebuild or an Expo development build

Build type

Release mode

Device

Android emulator

Device model

API 34 emulator (x86_64, Google APIs), Android 14

Acknowledgements

Yes

Activity

  1. m-bert commented on Oct 28, 2026

    @m-bert
    Collaborator

    Hi @YevheniiKotyrlo! Should be fixed in #4654, can you confirm that?

  2. YevheniiKotyrlo commented on Oct 28, 2026

    @YevheniiKotyrlo
    ContributorAuthor

    Confirmed, thanks! With #4654, delaysChildPressedState={false} takes effect in the minified release build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions