Skip to content

feat: RN 0.81 support #1794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"jest": "^30.0.2",
"prettier": "^2.8.8",
"react": "19.1.0",
"react-native": "0.80.1",
"react-native": "0.81.0-rc.1",
"react-native-gesture-handler": "^2.27.1",
"react-test-renderer": "19.1.0",
"release-it": "^19.0.3",
Expand Down
17 changes: 0 additions & 17 deletions src/__tests__/fire-event.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ const OnPressComponent = ({ onPress, text }: OnPressComponentProps) => (
</View>
);

type WithoutEventComponentProps = { onPress: () => void };
const WithoutEventComponent = (_props: WithoutEventComponentProps) => (
<View>
<Text>Without event</Text>
</View>
);

type CustomEventComponentProps = {
onCustomEvent: () => void;
};
Expand Down Expand Up @@ -75,16 +68,6 @@ describe('fireEvent', () => {
expect(onPressMock).toHaveBeenCalled();
});

test('should not fire if the press handler is not passed to children', () => {
const onPressMock = jest.fn();
render(
// TODO: this functionality is buggy, i.e. it will fail if we wrap this component with a View.
<WithoutEventComponent onPress={onPressMock} />,
);
fireEvent(screen.getByText('Without event'), 'press');
expect(onPressMock).not.toHaveBeenCalled();
});

test('should invoke event with custom name', () => {
const handlerMock = jest.fn();
const EVENT_DATA = 'event data';
Expand Down
7 changes: 4 additions & 3 deletions src/fire-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ function findEventHandler(
const touchResponder = isTouchResponder(element) ? element : nearestTouchResponder;

const handler = getEventHandler(element, eventName, { loose: true });
if (handler && isEventEnabled(element, eventName, touchResponder)) return handler;
if (handler && isEventEnabled(element, eventName, touchResponder)) {
return handler;
}

// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (element.parent === null || element.parent.parent === null) {
if (element.parent === null) {
return null;
}

Expand Down
Loading
Loading