Skip to content

Stories are not sorted in export order #778

@itsramiel

Description

@itsramiel

Describe the bug
According to the docs, the stories are sorted in export order, at least that is what I understand:

Image

But in my case they are not. Here is my stories file:

import type { Meta, StoryObj } from "@storybook/react";
import { fn } from "storybook/test";
import { View } from "react-native";
import { MyButton } from "./Button";

const meta = {
  title: "MyButton",
  component: MyButton,
  args: {
    text: "Hello world",
  },
  decorators: [
    (Story) => (
      <View style={{ padding: 16 }}>
        <Story />
      </View>
    ),
  ],
} satisfies Meta<typeof MyButton>;

export default meta;

type Story = StoryObj<typeof meta>;

export const C: Story = {
  args: {
    onPress: fn(),
  },
};

export const B: Story = {
  args: {
    onPress: fn(),
  },
};

export const A: Story = {
  args: {
    onPress: fn(),
  },
};

here is how they are represented:

Image

To Reproduce
Steps to reproduce the behavior:

  1. Start new project from template npx create-expo-app --template expo-template-storybook AwesomeStorybook
  2. Remove current Default story and add three stories in the order C, B, A as shown above
  3. Open app and notice how they are sorted alphabetically and not as exported

Expected behavior
I expect the stories to be sorted in export order

Screenshots
Provided above

Code snippets
Provided above

System:
Please paste the results of npx storybook@latest info here.

Storybook Environment Info:

  System:
    OS: macOS 15.6
    CPU: (14) arm64 Apple M3 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.14.0/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm <----- active
    pnpm: 9.1.1 - ~/.nvm/versions/node/v22.14.0/bin/pnpm
  Browsers:
    Chrome: 138.0.7204.184
    Safari: 18.6
  npmPackages:
    @storybook/addon-docs: ^9 => 9.1.1
    @storybook/addon-ondevice-actions: ^9 => 9.1.0
    @storybook/addon-ondevice-backgrounds: ^9 => 9.1.0
    @storybook/addon-ondevice-controls: ^9 => 9.1.0
    @storybook/addon-ondevice-notes: ^9 => 9.1.0
    @storybook/react: ^9 => 9.1.1
    @storybook/react-native: ^9 => 9.1.0
    @storybook/react-native-web-vite: ^9 => 9.1.1
    storybook: ^9 => 9.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions