Skip to content
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

Convert ResponderEventPlugin to createRoot #28190

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1377,11 +1377,12 @@ describe('ResponderEventPlugin', () => {
expect(ResponderEventPlugin._getResponder()).toBe(null);
});

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

const parent = ReactTestUtils.renderIntoDocument(<ParentComponent />);
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
let parent;
await act(() => {
root.render(<ParentComponent ref={current => (parent = current)} />);
});

const ancestors = [
// Common ancestor with self is self.
Expand Down