Repository navigation
feat: run the page on @rootnative/web - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run the page on @rootnative/web
The
devhub uipage now runs on@rootnative/webin place ofreact-native-web. The page source doesn't change.
What changed
apps/web/package.json: the page depends on@rootnative/web-expo0.0.10. Thereact-native-webdependency is gone.apps/web/metro.config.js: the config ends withwithRootNative(config).On the web, this helper sends each
react-nativeandreact-native-webimport to the new runtime. It works with the
nodeModulesPathsanddisableHierarchicalLookupsettings of the page.pnpm-lock.yaml: the new packages, and no react-native-web.The first commits used a package alias, from
0.0.0-alpha.4to0.0.0-alpha.7. The0.0.8commit removed the alias. The last two commitsmove to
0.0.9and0.0.10.Why
@rootnative/webrenders React Native components as plain DOM elements: anative
button,h1toh3, and aspanfor text. The page is its firstreal app.
On the same page, with production exports of both runtimes (Chromium, CPU
throttled 4x, medians of 10 runs):
@rootnative/web0.0.10The JavaScript gain was −7 % on
0.0.0-alpha.5.0.0.8added aVirtualizedList. The page has no list, but Reanimated'sAnimatedimportsFlatList, so the list code is in the bundle.0.0.10adds 578 B gzip to0.0.9. In a run of the two side by side, eachtiming is the same.
How I checked it
On
0.0.10:each menu and dialog, three widths, light and dark, and the desktop host
mode. All pass. The walk is the same as on
0.0.9. Each earlier versionmatched react-native-web: no text or control moved, and the screenshots
are the same.
apps/webpass.Electron host with an empty store: the load, the Devices and Setup pages,
and the Settings dialog with Escape. No console warning or error. The
window drag region works.
Validateand the tests on macOS and Windows pass, with theproduction export of the page.
Not checked: the packaged desktop app from the
Desktop packageworkflow,and the look of the window by eye.
What you'll see in the lockfile
react-native-webpackage.babel-plugin-react-native-webstays,because
babel-preset-expodepends on it. It's a Babel plugin, not theruntime.
@react-native/normalize-colors0.88.1 is nested under@rootnative/web.Metro can't load a nested package here, so the page uses the hoisted
0.88.0. The page walk passes with it.
How to go back
apps/web/package.json, put"react-native-web": "~0.21.4"in placeof
"@rootnative/web-expo": "0.0.10".apps/web/metro.config.js, removewithRootNative, and exportconfig.pnpm install.