@storybook/react-native 9.0.0-rc.5 → 9.0.4
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.js +10 -10
- package/package.json +5 -5
- package/readme.md +13 -11
package/dist/index.js
CHANGED
|
@@ -1110,27 +1110,27 @@ var View3 = class {
|
|
|
1110
1110
|
}
|
|
1111
1111
|
);
|
|
1112
1112
|
}
|
|
1113
|
-
if (
|
|
1113
|
+
if (CustomUIComponent) {
|
|
1114
1114
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1115
|
-
|
|
1115
|
+
CustomUIComponent,
|
|
1116
1116
|
{
|
|
1117
|
-
storage,
|
|
1118
|
-
theme: appliedTheme,
|
|
1119
|
-
storyHash,
|
|
1120
1117
|
story,
|
|
1118
|
+
storyHash,
|
|
1121
1119
|
setStory: (newStoryId) => self._channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId }),
|
|
1120
|
+
storage,
|
|
1121
|
+
theme: appliedTheme,
|
|
1122
1122
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StoryView_default, {})
|
|
1123
1123
|
}
|
|
1124
1124
|
);
|
|
1125
|
-
} else if (
|
|
1125
|
+
} else if (onDeviceUI) {
|
|
1126
1126
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1127
|
-
|
|
1127
|
+
FullUI,
|
|
1128
1128
|
{
|
|
1129
|
-
story,
|
|
1130
|
-
storyHash,
|
|
1131
|
-
setStory: (newStoryId) => self._channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId }),
|
|
1132
1129
|
storage,
|
|
1133
1130
|
theme: appliedTheme,
|
|
1131
|
+
storyHash,
|
|
1132
|
+
story,
|
|
1133
|
+
setStory: (newStoryId) => self._channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId }),
|
|
1134
1134
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StoryView_default, {})
|
|
1135
1135
|
}
|
|
1136
1136
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.4",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@storybook/csf": "^0.1.13",
|
|
50
50
|
"@storybook/global": "^5.0.0",
|
|
51
51
|
"@storybook/react": "^9",
|
|
52
|
-
"@storybook/react-native-theming": "^9.0.
|
|
53
|
-
"@storybook/react-native-ui": "^9.0.
|
|
54
|
-
"@storybook/react-native-ui-common": "^9.0.
|
|
52
|
+
"@storybook/react-native-theming": "^9.0.4",
|
|
53
|
+
"@storybook/react-native-ui": "^9.0.4",
|
|
54
|
+
"@storybook/react-native-ui-common": "^9.0.4",
|
|
55
55
|
"commander": "^8.2.0",
|
|
56
56
|
"dedent": "^1.5.1",
|
|
57
57
|
"deepmerge": "^4.3.0",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"access": "public"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "b161683ab01d83beb55ed05bef670b6a9af42da4"
|
|
109
109
|
}
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Storybook for React Native
|
|
2
2
|
|
|
3
|
-
> This readme is for v9
|
|
3
|
+
> This readme is for v9, for v8 docs see the [v8.6 docs](https://github.com/storybookjs/react-native/tree/v8.6.0-stable).
|
|
4
4
|
|
|
5
5
|
With Storybook for React Native you can design and develop individual React Native components without running your app.
|
|
6
6
|
|
|
@@ -54,7 +54,7 @@ npx storybook@latest init
|
|
|
54
54
|
The only thing left to do is return Storybook's UI in your app entry point (such as `App.tsx`) like this:
|
|
55
55
|
|
|
56
56
|
```tsx
|
|
57
|
-
export { default } from './.
|
|
57
|
+
export { default } from './.rnstorybook';
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
Then wrap your metro config with the withStorybook function as seen [below](#additional-steps-update-your-metro-config)
|
|
@@ -91,7 +91,8 @@ module.exports = withStorybook(config, {
|
|
|
91
91
|
// you can also use a env variable to set this
|
|
92
92
|
enabled: true,
|
|
93
93
|
// Path to your storybook config
|
|
94
|
-
configPath: path.resolve(__dirname, './.
|
|
94
|
+
configPath: path.resolve(__dirname, './.rnstorybook'),
|
|
95
|
+
// note that this is the default so you can the config path blank if you use .rnstorybook
|
|
95
96
|
|
|
96
97
|
// Optional websockets configuration
|
|
97
98
|
// Starts a websocket server on the specified port and host on metro start
|
|
@@ -126,7 +127,8 @@ module.exports = withStorybook(finalConfig, {
|
|
|
126
127
|
// you can also use a env variable to set this
|
|
127
128
|
enabled: true,
|
|
128
129
|
// Path to your storybook config
|
|
129
|
-
configPath: path.resolve(__dirname, './.
|
|
130
|
+
configPath: path.resolve(__dirname, './.rnstorybook'),
|
|
131
|
+
// note that this is the default so you can the config path blank if you use .rnstorybook
|
|
130
132
|
|
|
131
133
|
// Optional websockets configuration
|
|
132
134
|
// Starts a websocket server on the specified port and host on metro start
|
|
@@ -170,10 +172,10 @@ export const Basic: Story = {
|
|
|
170
172
|
};
|
|
171
173
|
```
|
|
172
174
|
|
|
173
|
-
You should configure the path to your story files in the `main.ts` config file from the `.
|
|
175
|
+
You should configure the path to your story files in the `main.ts` config file from the `.rnstorybook` folder.
|
|
174
176
|
|
|
175
177
|
```ts
|
|
176
|
-
// .
|
|
178
|
+
// .rnstorybook/main.ts
|
|
177
179
|
import { StorybookConfig } from '@storybook/react-native';
|
|
178
180
|
|
|
179
181
|
const main: StorybookConfig = {
|
|
@@ -216,10 +218,10 @@ const meta = {
|
|
|
216
218
|
export default meta;
|
|
217
219
|
```
|
|
218
220
|
|
|
219
|
-
For global decorators and parameters, you can add them to `preview.tsx` inside your `.
|
|
221
|
+
For global decorators and parameters, you can add them to `preview.tsx` inside your `.rnstorybook` folder.
|
|
220
222
|
|
|
221
223
|
```tsx
|
|
222
|
-
// .
|
|
224
|
+
// .rnstorybook/preview.tsx
|
|
223
225
|
import type { Preview } from '@storybook/react';
|
|
224
226
|
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds';
|
|
225
227
|
|
|
@@ -262,7 +264,7 @@ Currently the addons available are:
|
|
|
262
264
|
Install each one you want to use and add them to the `main.ts` addons list as follows:
|
|
263
265
|
|
|
264
266
|
```ts
|
|
265
|
-
// .
|
|
267
|
+
// .rnstorybook/main.ts
|
|
266
268
|
import { StorybookConfig } from '@storybook/react-native';
|
|
267
269
|
|
|
268
270
|
const main: StorybookConfig = {
|
|
@@ -346,11 +348,11 @@ This is useful if you want to remove storybook from your production build.
|
|
|
346
348
|
|
|
347
349
|
Type: `boolean`, default: `false`
|
|
348
350
|
|
|
349
|
-
Generates the `.
|
|
351
|
+
Generates the `.rnstorybook/storybook.requires` file in JavaScript instead of TypeScript.
|
|
350
352
|
|
|
351
353
|
#### configPath
|
|
352
354
|
|
|
353
|
-
Type: `string`, default: `path.resolve(process.cwd(), './.
|
|
355
|
+
Type: `string`, default: `path.resolve(process.cwd(), './.rnstorybook')`
|
|
354
356
|
|
|
355
357
|
The location of your Storybook configuration directory, which includes `main.ts` and other project-related files.
|
|
356
358
|
|