@storybook/react-native 9.0.0-beta.11 → 9.0.0-beta.13

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/index.d.ts CHANGED
@@ -41,7 +41,7 @@ type Params = {
41
41
  theme: ThemePartial;
42
42
  storage?: Storage;
43
43
  CustomUIComponent?: (props: {
44
- story: StoryContext<ReactRenderer, Args>;
44
+ story?: StoryContext<ReactRenderer, Args>;
45
45
  storyHash: API_IndexHash;
46
46
  setStory: (storyId: string) => void;
47
47
  storage: Storage;
@@ -37,6 +37,10 @@ interface WithStorybookOptions {
37
37
  * If enabled is false and onDisabledRemoveStorybook is true, we will attempt to remove storybook from the js bundle.
38
38
  */
39
39
  onDisabledRemoveStorybook?: boolean;
40
+ /**
41
+ * Whether to include doc tools in the storybook.requires file. Defaults to true.
42
+ */
43
+ docTools?: boolean;
40
44
  }
41
45
  /**
42
46
  * Configures Metro bundler to work with Storybook in React Native.
@@ -59,6 +63,7 @@ interface WithStorybookOptions {
59
63
  * configPath: path.resolve(projectRoot, './.rnstorybook'),
60
64
  * websockets: { port: 7007, host: 'localhost' },
61
65
  * useJs: false,
66
+ * docTools: true,
62
67
  * onDisabledRemoveStorybook: true,
63
68
  * });
64
69
  */
@@ -132,7 +132,12 @@ var require_generate = __commonJS({
132
132
  var fs = require("fs");
133
133
  var path2 = require("path");
134
134
  var cwd = process.cwd();
135
- function generate2({ configPath, absolute = false, useJs = false }) {
135
+ function generate2({
136
+ configPath,
137
+ /* absolute = false, */
138
+ useJs = false,
139
+ docTools = true
140
+ }) {
136
141
  const storybookRequiresLocation = path2.resolve(
137
142
  cwd,
138
143
  configPath,
@@ -170,8 +175,11 @@ var require_generate = __commonJS({
170
175
  `;
171
176
  }
172
177
  }
173
- const docTools = 'require("@storybook/react-native/preview")';
174
- const enhancers = [docTools];
178
+ const docToolsAnnotation = 'require("@storybook/react-native/preview")';
179
+ const enhancers = [];
180
+ if (docTools) {
181
+ enhancers.push(docToolsAnnotation);
182
+ }
175
183
  for (const addon of main.addons) {
176
184
  const previewPath = resolveAddonFile(
177
185
  getAddonName(addon),
@@ -254,14 +262,16 @@ var import_ws = require("ws");
254
262
  function withStorybook(config, options = {
255
263
  enabled: true,
256
264
  useJs: false,
257
- onDisabledRemoveStorybook: false
265
+ onDisabledRemoveStorybook: false,
266
+ docTools: true
258
267
  }) {
259
268
  const {
260
269
  configPath,
261
270
  enabled = true,
262
271
  websockets,
263
272
  useJs = false,
264
- onDisabledRemoveStorybook = false
273
+ onDisabledRemoveStorybook = false,
274
+ docTools = true
265
275
  } = options;
266
276
  if (!enabled) {
267
277
  if (onDisabledRemoveStorybook) {
@@ -302,7 +312,8 @@ function withStorybook(config, options = {
302
312
  }
303
313
  (0, import_generate.generate)({
304
314
  configPath: configPath ?? path.resolve(process.cwd(), "./.rnstorybook"),
305
- useJs
315
+ useJs,
316
+ docTools
306
317
  });
307
318
  return {
308
319
  ...config,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "9.0.0-beta.11",
3
+ "version": "9.0.0-beta.13",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -49,8 +49,8 @@
49
49
  "@storybook/csf": "^0.1.13",
50
50
  "@storybook/global": "^5.0.0",
51
51
  "@storybook/react": "9.0.0-beta.10",
52
- "@storybook/react-native-theming": "^9.0.0-beta.11",
53
- "@storybook/react-native-ui": "^9.0.0-beta.11",
52
+ "@storybook/react-native-theming": "^9.0.0-beta.13",
53
+ "@storybook/react-native-ui": "^9.0.0-beta.13",
54
54
  "commander": "^8.2.0",
55
55
  "dedent": "^1.5.1",
56
56
  "deepmerge": "^4.3.0",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "531ed8a758adc98bb436d0ccb32efcb369572ffe"
92
+ "gitHead": "092ffff0237dd5a9ccbb66d470db29108d2607c1"
93
93
  }
@@ -13,7 +13,7 @@ const path = require('path');
13
13
 
14
14
  const cwd = process.cwd();
15
15
 
16
- function generate({ configPath, absolute = false, useJs = false }) {
16
+ function generate({ configPath, /* absolute = false, */ useJs = false, docTools = true }) {
17
17
  const storybookRequiresLocation = path.resolve(
18
18
  cwd,
19
19
  configPath,
@@ -63,9 +63,13 @@ function generate({ configPath, absolute = false, useJs = false }) {
63
63
  }
64
64
  }
65
65
 
66
- const docTools = 'require("@storybook/react-native/preview")';
66
+ const docToolsAnnotation = 'require("@storybook/react-native/preview")';
67
67
 
68
- const enhancers = [docTools];
68
+ const enhancers = [];
69
+
70
+ if (docTools) {
71
+ enhancers.push(docToolsAnnotation);
72
+ }
69
73
 
70
74
  for (const addon of main.addons) {
71
75
  const previewPath = resolveAddonFile(
@@ -9,6 +9,7 @@ function getArguments() {
9
9
  './.rnstorybook'
10
10
  )
11
11
  .option('-js, --use-js', 'Use a js file for storybook.requires')
12
+ .option('-D, --no-doc-tools', 'Do not include doc tools in the storybook.requires file')
12
13
  .option('-a, --absolute', 'Use absolute paths for story imports');
13
14
 
14
15
  program.parse();