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

fix: support for react 19 and next15 #2731

Open
wants to merge 5 commits into
base: master
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
98 changes: 19 additions & 79 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/babel-plugin-react-native-web/src/moduleMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ module.exports = {
VirtualizedList: true,
YellowBox: true,
createElement: true,
findNodeHandle: true,
processColor: true,
render: true,
unmountComponentAtNode: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { ComponentType, Node } from 'react';

import AppContainer from './AppContainer';
import invariant from 'fbjs/lib/invariant';
import renderLegacy, { hydrateLegacy, render, hydrate } from '../render';
import render, { hydrate } from '../render';
import StyleSheet from '../StyleSheet';
import React from 'react';

Expand All @@ -27,18 +27,11 @@ export default function renderApplication<Props: Object>(
options: {
hydrate: boolean,
initialProps: Props,
mode: 'concurrent' | 'legacy',
rootTag: any
}
): Application {
const { hydrate: shouldHydrate, initialProps, mode, rootTag } = options;
const renderFn = shouldHydrate
? mode === 'concurrent'
? hydrate
: hydrateLegacy
: mode === 'concurrent'
? render
: renderLegacy;
const { hydrate: shouldHydrate, initialProps, rootTag } = options;
const renderFn = shouldHydrate ? hydrate : render;

invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);

Expand Down
27 changes: 0 additions & 27 deletions packages/react-native-web/src/exports/findNodeHandle/index.js

This file was deleted.

27 changes: 1 addition & 26 deletions packages/react-native-web/src/exports/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,21 @@

'use client';

import {
hydrate as domLegacyHydrate,
render as domLegacyRender
} from 'react-dom';
import {
createRoot as domCreateRoot,
hydrateRoot as domHydrateRoot
} from 'react-dom/client';

import unmountComponentAtNode from '../unmountComponentAtNode';
import { createSheet } from '../StyleSheet/dom';

export function hydrate(element, root) {
createSheet(root);
return domHydrateRoot(root, element);
}

export function render(element, root) {
export default function render(element, root) {
Viraj-10 marked this conversation as resolved.
Show resolved Hide resolved
createSheet(root);
const reactRoot = domCreateRoot(root);
reactRoot.render(element);
return reactRoot;
}

export function hydrateLegacy(element, root, callback) {
createSheet(root);
domLegacyHydrate(element, root, callback);
return {
unmount: function () {
return unmountComponentAtNode(root);
}
};
}

export default function renderLegacy(element, root, callback) {
createSheet(root);
domLegacyRender(element, root, callback);
return {
unmount: function () {
return unmountComponentAtNode(root);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
* @noflow
*/

import { unmountComponentAtNode } from 'react-dom';
export default unmountComponentAtNode;
export default function unmountComponentAtNode(rootTag) {
rootTag.unmount();
return true;
}
1 change: 0 additions & 1 deletion packages/react-native-web/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow strict
export { default as unstable_createElement } from './exports/createElement';
export { default as findNodeHandle } from './exports/findNodeHandle';
export { default as processColor } from './exports/processColor';
export { default as render } from './exports/render';
export { default as unmountComponentAtNode } from './exports/unmountComponentAtNode';
Expand Down
Loading