From d22cc65b0c1b7363d5aafe13fbcd6c84172dfd1b Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 5 Feb 2024 14:56:55 +0100 Subject: [PATCH] Merge pull request #25908 from storybookjs/dannyhw/fix-rn-init-existing-package React Native: Fix init fails when package is already installed (cherry picked from commit 985505a1b2263f535e9402b8d8fa190a1f4b3fec) --- code/lib/cli/src/generators/REACT_NATIVE/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/lib/cli/src/generators/REACT_NATIVE/index.ts b/code/lib/cli/src/generators/REACT_NATIVE/index.ts index 80230cdc690b..bb245cd1839b 100644 --- a/code/lib/cli/src/generators/REACT_NATIVE/index.ts +++ b/code/lib/cli/src/generators/REACT_NATIVE/index.ts @@ -14,12 +14,15 @@ const generator = async ( const reactVersion = packageJson.dependencies.react; - const packagesToResolve = [ - // addon-ondevice-controls peer deps + const controlsPeerDependencies = [ 'react-native-safe-area-context', '@react-native-async-storage/async-storage', '@react-native-community/datetimepicker', '@react-native-community/slider', + ].filter((dep) => !packageJson.dependencies[dep] && !packageJson.devDependencies[dep]); + + const packagesToResolve = [ + ...controlsPeerDependencies, '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-actions', '@storybook/react-native',