Currently using enabled prop in our buttons doesn't work. Mocks are done using TouchableNativeFeedback and it has disabled prop instead of enabled. This PR changes mocked version of our buttons to handle enabled properly.
Fixes #2385
Test plan
Run the following test
```tsx
import { fireEvent, render } from '@testing-library/react-native';
import Mocks from '../mocks';
describe.only('Testing disabled Button', () => {
it('onPress does not trigger', function () {
const onPress = jest.fn();
const { getByTestId } = render(
);
const btn = getByTestId('btn');
expect(onPress).not.toHaveBeenCalled();
fireEvent.press(btn);
expect(onPress).not.toHaveBeenCalled();
});
});
```
Description
Currently using
enabled
prop in our buttons doesn't work. Mocks are done usingTouchableNativeFeedback
and it hasdisabled
prop instead ofenabled
. This PR changes mocked version of our buttons to handleenabled
properly.Fixes #2385
Test plan
Run the following test
```tsx import { fireEvent, render } from '@testing-library/react-native'; import Mocks from '../mocks'; describe.only('Testing disabled Button', () => { it('onPress does not trigger', function () { const onPress = jest.fn(); const { getByTestId } = render(