Skip to content

[Bug]: initialGlobals.viewport not applied when using INITIAL_VIEWPORTS + custom options (react-native-web-vite) #33839

@cosmin-jescu-aily

Description

@cosmin-jescu-aily

Describe the bug

When using Storybook for React Native Web with Vite, initialGlobals.viewport is only applied if the value matches a key from the minimal built-in viewports (mobile1, mobile2, tablet, desktop). If I use a key from INITIAL_VIEWPORTS or from my custom viewports, no viewport is selected.

Screen.Recording.2026-02-13.at.16.22.29.mov

Reproduction link

https://stackblitz.com/edit/github-wgyiqhmr-bjv33gcv?file=.storybook%2Fpreview.js

Reproduction steps

Start Storybook for React Native Web Vite.
Load a story.
Observe the viewport toolbar.

System

│  System:
│  OS: macOS 26.2
│  CPU: (8) arm64 Apple M3
│  Shell: 5.9 - /bin/zsh
│  Binaries:
│  Node: 22.22.0 - /Users/cosmin.jescu/.nvm/versions/node/v22.22.0/bin/node
│  npm: 10.9.4 - /Users/cosmin.jescu/.nvm/versions/node/v22.22.0/bin/npm <-----
│  active
│  pnpm: 9.4.0 - /opt/homebrew/bin/pnpm
│  Browsers:
│  Chrome: 123.0.6312.87
│  Safari: 26.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions