Skip to content

[Android]: Modal with slide animation suppresses onPress callbacks #5739

Closed as not planned
@cjshearer

Description

@cjshearer

Description

Actionsheet (or a modal containing a slide transition) suppresses callbacks for children when using the slide animation.

CodeSandbox/Snack link

https://codesandbox.io/s/delicate-sound-6dodwc?file=/src/components/Example.tsx

Steps to reproduce

  1. Create an Actionsheet containing a child with an onPress callback. Let's say it's a button.
  2. With a physical Android device, click on the actionsheet's button (this seems to work just fine on an emulator).

Note how, despite the button visually reacting to the press, the button's callback does not run.

  1. Add animationPreset="none" to the Actionsheet's props
  2. Repeat step 2

Note how the button's callback now runs.

NativeBase Version

3.3.1

Platform

  • Android
  • CRA
  • Expo
  • iOS
  • Next

Other Platform

Pixel 7 - Android 13, LGV30 - Android 10, Pixel 3 - Android 12.

Additional Information

We're using the new architecture.

I believe the origin of this issue comes somewhere from the native-base/src/components/composites/Transitions/Slide.tsx or one of its dependencies, as this only occurs when a Modal has a slide transition (as an Actionsheet does by default on an Android device). Disabling the slide animation resolves the issue. I'll admit it's possible this bug comes from a library used by native base, but this seems like a good start to discover the source of the issue and at the very least it documents a work around.

The below video shows the issue as presented from steps 1 and 2, followed by steps 3 and 4 after the hot-reload that disables the slide animation.

ScreenRecord-2023-04-25-09-50-16.mp4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions