Skip to content

Commit 2a764c7

Browse files
chore: RN 0.81 support (#1794)
1 parent 1b12be4 commit 2a764c7

File tree

4 files changed

+790
-820
lines changed

4 files changed

+790
-820
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"@babel/preset-react": "^7.25.9",
7373
"@babel/preset-typescript": "^7.26.0",
7474
"@callstack/eslint-config": "^15.0.0",
75-
"@react-native/babel-preset": "0.80.1",
75+
"@react-native/babel-preset": "0.81.0-rc.3",
7676
"@release-it/conventional-changelog": "^10.0.0",
7777
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
7878
"@types/jest": "^30.0.0",
@@ -88,7 +88,7 @@
8888
"jest": "^30.0.2",
8989
"prettier": "^2.8.8",
9090
"react": "19.1.0",
91-
"react-native": "0.80.1",
91+
"react-native": "0.81.0-rc.3",
9292
"react-native-gesture-handler": "^2.27.1",
9393
"react-test-renderer": "19.1.0",
9494
"release-it": "^19.0.3",

src/__tests__/fire-event.test.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ const OnPressComponent = ({ onPress, text }: OnPressComponentProps) => (
2323
</View>
2424
);
2525

26-
type WithoutEventComponentProps = { onPress: () => void };
27-
const WithoutEventComponent = (_props: WithoutEventComponentProps) => (
28-
<View>
29-
<Text>Without event</Text>
30-
</View>
31-
);
32-
3326
type CustomEventComponentProps = {
3427
onCustomEvent: () => void;
3528
};
@@ -75,16 +68,6 @@ describe('fireEvent', () => {
7568
expect(onPressMock).toHaveBeenCalled();
7669
});
7770

78-
test('should not fire if the press handler is not passed to children', () => {
79-
const onPressMock = jest.fn();
80-
render(
81-
// TODO: this functionality is buggy, i.e. it will fail if we wrap this component with a View.
82-
<WithoutEventComponent onPress={onPressMock} />,
83-
);
84-
fireEvent(screen.getByText('Without event'), 'press');
85-
expect(onPressMock).not.toHaveBeenCalled();
86-
});
87-
8871
test('should invoke event with custom name', () => {
8972
const handlerMock = jest.fn();
9073
const EVENT_DATA = 'event data';

src/fire-event.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ function findEventHandler(
8282
const touchResponder = isTouchResponder(element) ? element : nearestTouchResponder;
8383

8484
const handler = getEventHandler(element, eventName, { loose: true });
85-
if (handler && isEventEnabled(element, eventName, touchResponder)) return handler;
85+
if (handler && isEventEnabled(element, eventName, touchResponder)) {
86+
return handler;
87+
}
8688

87-
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
88-
if (element.parent === null || element.parent.parent === null) {
89+
if (element.parent === null) {
8990
return null;
9091
}
9192

0 commit comments

Comments
 (0)