mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-15 13:38:29 +02:00

* chore: add unstable entrance * chore: rest of it * chore: use React 19 * chore: fix lint * chore: fix lint * chore: fix lint * chore: fix lint * chore: fix lint * chore: fix lint * chore: fix lint * chore: test ignore 19 preload * chore: bump rc-util * fix: warning of pure render * fix: warning of 19 * chore: adjust ts * test: fix test logic * test: fix test case * test: fix test case * test: fix test case * test: fix test case * test: fix test case * test: fix test case * test: fix test case * test: fix test case * chore: restore file * test: fix test case * test: fix test case * test: fix test case * test: fix test case * test: fix test case * test: update test * test: fix test case * test: update snapshot * test: fix coverage * test: fix coverage * test: add ignore image
30 lines
777 B
TypeScript
30 lines
777 B
TypeScript
import * as React from 'react';
|
|
import { render, unmount } from 'rc-util/lib/React/render';
|
|
|
|
export type UnmountType = () => Promise<void>;
|
|
export type RenderType = (
|
|
node: React.ReactElement,
|
|
container: Element | DocumentFragment,
|
|
) => UnmountType;
|
|
|
|
const defaultReactRender: RenderType = (node, container) => {
|
|
render(node, container);
|
|
return () => {
|
|
return unmount(container);
|
|
};
|
|
};
|
|
|
|
let unstableRender: RenderType = defaultReactRender;
|
|
|
|
/**
|
|
* @deprecated Set React render function for compatible usage.
|
|
* This is internal usage only compatible with React 19.
|
|
* And will be removed in next major version.
|
|
*/
|
|
export function unstableSetRender(render: RenderType) {
|
|
unstableRender = render;
|
|
}
|
|
|
|
export function getReactRender() {
|
|
return unstableRender;
|
|
}
|