Closed
Description
Describe the bug
When running fireEvent.press
on a disabled TouchableOpacity, the following error appears: No handler function found for event: "press"
Expected behavior
Should not raise an error
Steps to Reproduce
Run the following
import { TouchableOpacity } from 'react-native'
describe.only('Test TouchableOpacity', () => {
const Button = ({ onPress }) => {
return <TouchableOpacity testID='testBtn' disabled={true} onPress={onPress}></TouchableOpacity>
}
const onPressSpy = sinon.spy()
it('onPress does not trigger', () => {
const { getByTestId } = render( <Button onPress={onPressSpy}/>)
fireEvent.press(getByTestId('testBtn'))
expect(props.onPress.callCount).toBe(0)
})
})
Versions
npmPackages:
@testing-library/react-native: ^7.0.0 => 7.0.0
react: 16.13.1 => 16.13.1
react-native: 0.63.0 => 0.63.0
react-test-renderer: ^16.13.0 => 16.13.1
Metadata
Metadata
Assignees
Labels
No labels