Skip to content

Wrapped TextInput with editable set to false calls onFocus anyway #1384

Closed
@TMaszko

Description

@TMaszko

Describe the bug

When fireEvent is called with wrapped TextInput(i.e with styled-components) that is disabled the event bubbles up.
For example: We want to check if the TextInput component is actually disabled we might check whether onFocus event handler was called or not.

Expected behaviour

onFocus handler should not be called if the TextInput is disabled (aka editable prop set to false)

Steps to Reproduce

https://github.com/TMaszko/FireEventBug
Install dependencies and run yarn test

Versions

npmPackages:
@testing-library/react-native: ^12.0.1 => 12.0.1
react: 18.2.0 => 18.2.0
react-native: 0.71.6 => 0.71.6
react-test-renderer: ^18.2.0 => 18.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions