-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
React Native Web: Add framework, CLI integration, sandboxes #29520
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 38c6859. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
539cc58
to
ff61894
Compare
ff61894
to
6f9594f
Compare
627893b
to
ea86393
Compare
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
Before | After | Difference | |
---|---|---|---|
Dependency count | 0 | 109 | 🚨 +109 🚨 |
Self size | 0 B | 37 KB | 🚨 +37 KB 🚨 |
Dependency size | 0 B | 18.69 MB | 🚨 +18.69 MB 🚨 |
Bundle Size Analyzer | Link | Link |
Failed to publish canary version of this pull request, triggered by @shilman. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/11870905006 |
d787436
to
751085b
Compare
751085b
to
ee7b69f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
56 file(s) reviewed, 48 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -0,0 +1,3 @@ | |||
# Storybook for React Native Web & Vite | |||
|
|||
See [documentation](https://storybook.js.org/docs/get-started/frameworks/react-native-web-vite?renderer=react-native-web) for installation instructions, usage examples, APIs, and more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Documentation URL uses 'react-native-web' as renderer but framework uses 'react' renderer internally. Consider aligning these or documenting the difference.
{ | ||
"name": "@storybook/react-native-web-vite", | ||
"version": "8.5.0-alpha.5", | ||
"description": "Develop react-native components an isolated web environment with hot reloading.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: typo in description: 'an isolated' should be 'in an isolated'
"targets": { | ||
"build": {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Build target is empty. Consider adding standard NX build configuration like executor, options, and configurations for proper build integration.
// @ts-expect-error FIXME | ||
import { viteFinal as reactViteFinal } from '@storybook/react-vite/preset'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: TODO needs to be addressed - ts-expect-error should be removed by properly typing the import
include: [], | ||
esbuildOptions: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: empty include array may cause optimization issues - consider adding common dependencies
|
||
* ⚛️ React Native components | ||
* 🧑💻 Shareable on the web | ||
* 🪄 Zero confg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Typo in 'confg', should be 'config'
|
||
### In a project with Storybook `addon-react-native-web` | ||
|
||
The [React Native Web addon](https://github.com/storybookjs/addon-react-native-web), `@storybook/addon-react-native-web` was Webpack-based precursor the React Native Web Vite framework `@storybook/react-native-web-vite`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Missing word 'to' after 'precursor'
|
||
[Storybook for React Native](https://github.com/storybookjs/react-native) is a framework that runs in a simulator or on your mobile device. | ||
|
||
It's possible to run React Native Web alongside React Native, but we are still working on a seamless integration. In the mantime, we recommend running one or the other. If you're not sure what's right for you, read our [comparison](#react-native-vs-react-native-web). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Typo in 'mantime', should be 'meantime'
**Web.** You should choose Web if you want: | ||
|
||
- [**Sharing](https://storybook.js.org/docs/sharing).** Publish to the web and share with your team or publicly. | ||
- [**Documentation](https://storybook.js.org/docs/writing-docs). A**uto-generated component docs or rich markdown docs in MDX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Formatting error: 'A**uto-generated' should be 'Auto-generated'
|
||
{/* prettier-ignore-start */} | ||
|
||
<CodeSnippets path="react-vite-add-framework.md" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Incorrect snippet reference 'react-vite-add-framework.md', should likely be 'react-native-web-vite-add-framework.md'
"vite": "^4.0.0 || ^5.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the allowed engine. Since this is a new framework, let's not support Node 18 anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more comfortable making the switch along with all the other frameworks.
* | ||
* @default false | ||
*/ | ||
legacyRootApi?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we support legacy api in a new framework?
"@vitejs/plugin-react": "^3.0.1", | ||
"@vitejs/plugin-react": "^4.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does @vitejs/plugin-react
have to be in code
or can we remove it from here?
Closes #
What I did
Barebones Vite-based React Native Web framework,
@storybook/react-native-web-vite
, based on https://github.com/storybookjs/addon-react-native-web/storybook init --type react_native_web
Button
/Header
/Page
components/stories.css
filesFollow-up work
react-native-web
renderer docsstorybook add @storybook/experimental-addon-test
(if needed)Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-29520-sha-c92aa93a
. Try it out in a new sandbox by runningnpx [email protected] sandbox
or in an existing project withnpx [email protected] upgrade
.More information
0.0.0-pr-29520-sha-c92aa93a
shilman/react-native-web-vite
c92aa93a
1731768884
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=29520
Greptile Summary
Added React Native Web Vite framework to Storybook with CLI integration, sandboxes, and test coverage, focusing on proper Vite configuration and React Native Web component support.
@storybook/react-native-web-vite
framework with Vite-specific configuration incode/frameworks/react-native-web-vite/src/preset.ts
code/frameworks/react-native-web-vite/template/cli/
code/core/src/cli/detect.ts
andcode/core/src/cli/project_types.ts
code/lib/cli-storybook/src/sandbox-templates.ts