Skip to content

Conversation

ozgegurel
Copy link

This PR fixes two issues that were causing build errors and deprecation warnings.

Issue 1: Deprecated CLI Command Warnings

Deprecated npx react-native init command was causing warnings:

🚨️ The init command is deprecated. Switch to npx @react-native-community/cli init for the identical behavior.

What I did

  • Updated the README to use the current React Native CLI command npx @react-native-community/cli init instead of the deprecated one npx react-native init

How to test

Try the new command format:

npx @react-native-community/cli init MyApp --template react-native-template-storybook

Issue 2: StorybookConfig Import Error

When creating a new project using this template and running npm run storybook, the following error occurs:

SyntaxError: The requested module @storybook/react-native does not provide an export named StorybookConfig

What I did

  • Changed to TypeScript type-only import to fix the compilation error
    from import { StorybookConfig } to import type { StorybookConfig }

How to test

  1. First create a project and install dependencies:
npx @react-native-community/cli init TestApp --template react-native-template-storybook
npm install --legacy-peer-deps
  1. Run storybook and observe the error:
npm run storybook

It gives StorybookConfig error:
SyntaxError: The requested module '@storybook/react-native' does not provide an export named 'StorybookConfig'

  1. After fixing the TypeScript error, the template-generated TestApp project works correctly without errors:
npx @react-native-community/cli init TestApp --template file://$(pwd)
cd TestApp && npm install --legacy-peer-deps
npm run storybook 
storybook works fine

Should work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant