Skip to content

Commit 2a45118

Browse files
authored
Convert ResponderEventPlugin to createRoot (#28190)
1 parent 2dc428f commit 2a45118

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/react-native-renderer/src/__tests__/ResponderEventPlugin-test.internal.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1377,11 +1377,12 @@ describe('ResponderEventPlugin', () => {
13771377
expect(ResponderEventPlugin._getResponder()).toBe(null);
13781378
});
13791379

1380-
it('should determine the first common ancestor correctly', () => {
1380+
it('should determine the first common ancestor correctly', async () => {
13811381
// This test was moved here from the ReactTreeTraversal test since only the
13821382
// ResponderEventPlugin uses `getLowestCommonAncestor`
13831383
const React = require('react');
1384-
const ReactTestUtils = require('react-dom/test-utils');
1384+
const ReactDOMClient = require('react-dom/client');
1385+
const act = require('internal-test-utils').act;
13851386
const getLowestCommonAncestor =
13861387
require('react-native-renderer/src/legacy-events/ResponderEventPlugin').getLowestCommonAncestor;
13871388
// This works by accident and will likely break in the future.
@@ -1422,7 +1423,12 @@ describe('ResponderEventPlugin', () => {
14221423
}
14231424
}
14241425

1425-
const parent = ReactTestUtils.renderIntoDocument(<ParentComponent />);
1426+
const container = document.createElement('div');
1427+
const root = ReactDOMClient.createRoot(container);
1428+
let parent;
1429+
await act(() => {
1430+
root.render(<ParentComponent ref={current => (parent = current)} />);
1431+
});
14261432

14271433
const ancestors = [
14281434
// Common ancestor with self is self.

0 commit comments

Comments
 (0)