@storybook/react-native 9.0.14 → 9.0.18-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/metro/withStorybook.d.ts +5 -0
- package/dist/metro/withStorybook.js +13 -4
- package/package.json +8 -8
- package/readme.md +3 -3
- package/scripts/generate.js +2 -2
- package/template/cli/main.ts +1 -1
|
@@ -41,6 +41,11 @@ interface WithStorybookOptions {
|
|
|
41
41
|
* Whether to include doc tools in the storybook.requires file. Defaults to true.
|
|
42
42
|
*/
|
|
43
43
|
docTools?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to use lite mode for the storybook. Defaults to false.
|
|
46
|
+
* This will mock out the default storybook ui so you don't need to install all its dependencies like reanimated etc.
|
|
47
|
+
*/
|
|
48
|
+
liteMode?: boolean;
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* Configures Metro bundler to work with Storybook in React Native.
|
|
@@ -199,7 +199,7 @@ var require_generate = __commonJS({
|
|
|
199
199
|
let optionsVar = "";
|
|
200
200
|
const reactNativeOptions = main.reactNative;
|
|
201
201
|
if (reactNativeOptions && typeof reactNativeOptions === "object") {
|
|
202
|
-
optionsVar = `const options = ${JSON.stringify(reactNativeOptions, null,
|
|
202
|
+
optionsVar = `const options = ${JSON.stringify(reactNativeOptions, null, 2)}`;
|
|
203
203
|
options = "options";
|
|
204
204
|
}
|
|
205
205
|
const previewExists = getPreviewExists({ configPath });
|
|
@@ -221,7 +221,7 @@ import { start, updateView${useJs ? "" : ", View"} } from '@storybook/react-nati
|
|
|
221
221
|
${registeredAddons.join("\n")}
|
|
222
222
|
|
|
223
223
|
const normalizedStories = [
|
|
224
|
-
${normalizedStories.join(",\n")}
|
|
224
|
+
${normalizedStories.join(",\n ")}
|
|
225
225
|
];
|
|
226
226
|
|
|
227
227
|
${useJs ? "" : globalTypes}
|
|
@@ -266,7 +266,8 @@ function withStorybook(config, options = {
|
|
|
266
266
|
enabled: true,
|
|
267
267
|
useJs: false,
|
|
268
268
|
onDisabledRemoveStorybook: false,
|
|
269
|
-
docTools: true
|
|
269
|
+
docTools: true,
|
|
270
|
+
liteMode: false
|
|
270
271
|
}) {
|
|
271
272
|
const {
|
|
272
273
|
configPath,
|
|
@@ -274,7 +275,8 @@ function withStorybook(config, options = {
|
|
|
274
275
|
websockets,
|
|
275
276
|
useJs = false,
|
|
276
277
|
onDisabledRemoveStorybook = false,
|
|
277
|
-
docTools = true
|
|
278
|
+
docTools = true,
|
|
279
|
+
liteMode = false
|
|
278
280
|
} = options;
|
|
279
281
|
if (!enabled) {
|
|
280
282
|
if (onDisabledRemoveStorybook) {
|
|
@@ -340,6 +342,13 @@ function withStorybook(config, options = {
|
|
|
340
342
|
type: "empty"
|
|
341
343
|
};
|
|
342
344
|
}
|
|
345
|
+
if (liteMode) {
|
|
346
|
+
if (resolveResult?.filePath?.includes?.("@storybook/react-native-ui") && !resolveResult?.filePath?.includes?.("@storybook/react-native-ui-lite") && !resolveResult?.filePath?.includes?.("@storybook/react-native-ui-common")) {
|
|
347
|
+
return {
|
|
348
|
+
type: "empty"
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
343
352
|
return resolveResult;
|
|
344
353
|
}
|
|
345
354
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.18-alpha.0",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@storybook/global": "^5.0.0",
|
|
50
|
-
"@storybook/react": "9.0.
|
|
51
|
-
"@storybook/react-native-theming": "^9.0.
|
|
52
|
-
"@storybook/react-native-ui": "^9.0.
|
|
53
|
-
"@storybook/react-native-ui-common": "^9.0.
|
|
50
|
+
"@storybook/react": "^9.0.17",
|
|
51
|
+
"@storybook/react-native-theming": "^9.0.18-alpha.0",
|
|
52
|
+
"@storybook/react-native-ui": "^9.0.18-alpha.0",
|
|
53
|
+
"@storybook/react-native-ui-common": "^9.0.18-alpha.0",
|
|
54
54
|
"commander": "^8.2.0",
|
|
55
55
|
"dedent": "^1.5.1",
|
|
56
56
|
"deepmerge": "^4.3.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react": "19.0.0",
|
|
72
72
|
"react-native": "0.79.2",
|
|
73
73
|
"react-test-renderer": "^19.1.0",
|
|
74
|
-
"storybook": "9.0.
|
|
74
|
+
"storybook": "^9.0.17",
|
|
75
75
|
"tsup": "^7.2.0",
|
|
76
76
|
"typescript": "~5.8.3"
|
|
77
77
|
},
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"react-native-gesture-handler": ">=2",
|
|
83
83
|
"react-native-reanimated": ">=2",
|
|
84
84
|
"react-native-safe-area-context": "*",
|
|
85
|
-
"storybook": "9.0.
|
|
85
|
+
"storybook": "^9.0.17"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|
|
88
88
|
"@gorhom/bottom-sheet": {
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "4db4eab32c4494fe22d21519d3db5308c9a23660"
|
|
108
108
|
}
|
package/readme.md
CHANGED
|
@@ -40,7 +40,7 @@ npx create-expo-app --template expo-template-storybook AwesomeStorybook
|
|
|
40
40
|
For react native cli you can use this [template](https://github.com/dannyhw/react-native-template-storybook)
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
|
-
npx react-native init MyApp --template react-native-template-storybook
|
|
43
|
+
npx @react-native-community/cli init MyApp --template react-native-template-storybook
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
### Existing project
|
|
@@ -176,7 +176,7 @@ You should configure the path to your story files in the `main.ts` config file f
|
|
|
176
176
|
|
|
177
177
|
```ts
|
|
178
178
|
// .rnstorybook/main.ts
|
|
179
|
-
import { StorybookConfig } from '@storybook/react-native';
|
|
179
|
+
import type { StorybookConfig } from '@storybook/react-native';
|
|
180
180
|
|
|
181
181
|
const main: StorybookConfig = {
|
|
182
182
|
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
|
|
@@ -265,7 +265,7 @@ Install each one you want to use and add them to the `main.ts` addons list as fo
|
|
|
265
265
|
|
|
266
266
|
```ts
|
|
267
267
|
// .rnstorybook/main.ts
|
|
268
|
-
import { StorybookConfig } from '@storybook/react-native';
|
|
268
|
+
import type { StorybookConfig } from '@storybook/react-native';
|
|
269
269
|
|
|
270
270
|
const main: StorybookConfig = {
|
|
271
271
|
// ... rest of config
|
package/scripts/generate.js
CHANGED
|
@@ -94,7 +94,7 @@ function generate({ configPath, /* absolute = false, */ useJs = false, docTools
|
|
|
94
94
|
const reactNativeOptions = main.reactNative;
|
|
95
95
|
|
|
96
96
|
if (reactNativeOptions && typeof reactNativeOptions === 'object') {
|
|
97
|
-
optionsVar = `const options = ${JSON.stringify(reactNativeOptions, null,
|
|
97
|
+
optionsVar = `const options = ${JSON.stringify(reactNativeOptions, null, 2)}`;
|
|
98
98
|
options = 'options';
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -121,7 +121,7 @@ import { start, updateView${useJs ? '' : ', View'} } from '@storybook/react-nati
|
|
|
121
121
|
${registeredAddons.join('\n')}
|
|
122
122
|
|
|
123
123
|
const normalizedStories = [
|
|
124
|
-
${normalizedStories.join(',\n')}
|
|
124
|
+
${normalizedStories.join(',\n ')}
|
|
125
125
|
];
|
|
126
126
|
|
|
127
127
|
${useJs ? '' : globalTypes}
|
package/template/cli/main.ts
CHANGED