---
title: "Discussion on \"Using Storybook with Expo Router v2, SDK 49 & TypeScript\" | Hashnode"
description: "Discussion on \"Using Storybook with Expo Router v2, SDK 49 & TypeScript\". In this post, I'll guide you to build a working repo with Expo SDK 49, Storybook for React Native, Expo Router v2, TypeScript, and more!"
url: "https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Using Storybook with Expo Router v2, SDK 49 & TypeScript](https://blog.spirokit.com/using-storybook-with-expo-router-v2-sdk-49-typescript?utm_source=hashnode&utm_medium=feed)

In this post, I'll guide you to build a working repo with Expo SDK 49, Storybook for React Native, Expo Router v2, TypeScript, and more!

Jul 13, 2023 · 13 min read · blog.spirokit.com  
Read the article

-   [#react-native](https://hashnode.com/tag/react-native)
-   [#expo](https://hashnode.com/tag/expo)
-   [#storybook](https://hashnode.com/tag/storybook)
-   [#typescript](https://hashnode.com/tag/typescript)

## Written by

[Mauro Garcia](https://hashnode.com/@mauro-codes)

@mauro-codes · Buenos Aires, Argentina

  
[View profile](https://hashnode.com/@mauro-codes)

Software Developer

## Responses 4

Markdown supported · ⌘↵ to post

[Hayata Suenaga](https://hashnode.com/@Hayata)

[Jan 10, 2024](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/659e2bac67939dc421ce405e)

I really enjoyed the article, and it was very helpful in getting started with setting up Storybook in my Expo project.

Now, as I'm trying to create a production build, I have a new question. How can we ensure that the production build doesn't include Storybook code?

Switching the real and Storybook application conditionally inside the code doesn't prevent Metro from bundling Storybook code.

I'm currently exploring a solution to this issue, but if you have any suggestions, I would greatly appreciate it if you could share your thoughts.

[Thorr ⚡️ codinsonn.dev](https://hashnode.com/@codinsonn)

[Nov 4, 2023](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/6546984231ab12d0f49f1863)

Hey, cool guide! Any chance at a followup guide for Storybook Web?

[Mauro Garcia](https://hashnode.com/@mauro-codes)

[Nov 4, 2023](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/6546984231ab12d0f49f1863#reply-6546bd5031ab12d0f49f1ab9)

Thanks! Yes! In fact I already published another post covering how to setup storybook web and mobile in the same repo.

[blog.spirokit.com/setting-up-storybook-web-and-na…](https://blog.spirokit.com/setting-up-storybook-web-and-native-with-expo-router-v2-sdk-49-and-typescript)

[David](https://hashnode.com/@flexbox)

[Oct 13, 2023](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/6529464d2f8d4e00663bb3fe)

Thanks for the guide!

I recently created a new project with expo-router and I was confused with the app/ folder

One suggestion tho

my launch script looks like this

```
"storybook": "sb-rn-get-stories && EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start",
```

and the index.tsx page

```
const storybookEnabled = process.env.EXPO_PUBLIC_STORYBOOK_ENABLED;
```

I don't have `.env` file, no need to manually edit, it's faster to swap between the app or the storybook with

```
yarn start
yarn storybook
```

[Mauro Garcia](https://hashnode.com/@mauro-codes)

[Oct 13, 2023](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/6529464d2f8d4e00663bb3fe#reply-652951ead2fa06034fe34a68)

Glad to help, David! And thanks for your comment about the alternative. I implemented the .env file that way for 2 main reasons: 1 - It works on any OS, including Windows 2 - I wanted to experiment with the new Expo env variables support

Adding the env flags directly in the package.json may be convenient, but I'll need to use cross-env or something similar so it can work on Windows.

[Joe](https://hashnode.com/@joevaugh4n)

[Jul 21, 2023](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/64ba67ec55df3bebc626ad99)

Hey Mauro! I'm one of the Storybook maintainers. Just to say we loved this! 💖

[Mauro Garcia](https://hashnode.com/@mauro-codes)

[Jul 21, 2023](https://hashnode.com/posts/using-storybook-with-expo-router-v2-sdk-49-typescript/64b022fe0ba7115b2af1d9ce/comment/64ba67ec55df3bebc626ad99#reply-64bacab2553279ef7cf45b69)

Thanks Joe! Glad to hear that 🙌 Happy to connect 🙂 I’m already working on the next article that adds Storybook web in the same repo.
