Skip to content

Commit

Permalink
fix: remove hydrate and render
Browse files Browse the repository at this point in the history
  • Loading branch information
Viraj-10 committed Oct 28, 2024
1 parent 4432269 commit e85fefb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
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
25 changes: 0 additions & 25 deletions packages/react-native-web/src/exports/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@

'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) {
Expand All @@ -32,23 +27,3 @@ export function render(element, 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);
}
};
}

0 comments on commit e85fefb

Please sign in to comment.