@storybook/react-native 10.4.0-canary-20260429093015 → 10.4.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/index.js +26 -7
- package/dist/withStorybook.js +2 -5
- package/package.json +6 -6
- package/readme.md +6 -6
package/dist/index.js
CHANGED
|
@@ -1714,15 +1714,13 @@ var View3 = class {
|
|
|
1714
1714
|
}
|
|
1715
1715
|
);
|
|
1716
1716
|
} else {
|
|
1717
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
1717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native_safe_area_context.SafeAreaProvider, { children: [
|
|
1718
1718
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native4.StatusBar, { hidden: true }),
|
|
1719
1719
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1720
|
-
|
|
1720
|
+
WithSafeArea,
|
|
1721
1721
|
{
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
testID: story?.id,
|
|
1725
|
-
accessible: true,
|
|
1722
|
+
id: story?.id ?? "",
|
|
1723
|
+
safeAreaEnabled: !(story?.parameters?.noSafeArea ?? false),
|
|
1726
1724
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1727
1725
|
StoryView_default,
|
|
1728
1726
|
{
|
|
@@ -1732,11 +1730,32 @@ var View3 = class {
|
|
|
1732
1730
|
)
|
|
1733
1731
|
}
|
|
1734
1732
|
)
|
|
1735
|
-
] })
|
|
1733
|
+
] });
|
|
1736
1734
|
}
|
|
1737
1735
|
};
|
|
1738
1736
|
};
|
|
1739
1737
|
};
|
|
1738
|
+
var WithSafeArea = ({
|
|
1739
|
+
children,
|
|
1740
|
+
id,
|
|
1741
|
+
safeAreaEnabled
|
|
1742
|
+
}) => {
|
|
1743
|
+
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1745
|
+
import_react_native4.View,
|
|
1746
|
+
{
|
|
1747
|
+
style: {
|
|
1748
|
+
flex: 1,
|
|
1749
|
+
paddingTop: safeAreaEnabled ? insets.top : 0,
|
|
1750
|
+
paddingBottom: safeAreaEnabled ? insets.bottom : 0
|
|
1751
|
+
},
|
|
1752
|
+
accessibilityLabel: id,
|
|
1753
|
+
testID: id,
|
|
1754
|
+
accessible: true,
|
|
1755
|
+
children
|
|
1756
|
+
}
|
|
1757
|
+
);
|
|
1758
|
+
};
|
|
1740
1759
|
|
|
1741
1760
|
// src/prepareStories.ts
|
|
1742
1761
|
var import_preview_api2 = require("storybook/internal/preview-api");
|
package/dist/withStorybook.js
CHANGED
|
@@ -623,7 +623,7 @@ function enhanceMetroConfig(config, options = {}) {
|
|
|
623
623
|
resolver: {
|
|
624
624
|
...config.resolver,
|
|
625
625
|
resolveRequest: (context, moduleName, platform) => {
|
|
626
|
-
if (moduleName === "tty" || moduleName === "os") {
|
|
626
|
+
if (platform !== "web" && (moduleName === "tty" || moduleName === "os")) {
|
|
627
627
|
return { type: "empty" };
|
|
628
628
|
}
|
|
629
629
|
const resolveFunction = config?.resolver?.resolveRequest ? config.resolver.resolveRequest : context.resolveRequest;
|
|
@@ -684,10 +684,7 @@ function resolveEntryPoint(projectRoot = process.cwd()) {
|
|
|
684
684
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
685
685
|
mainField = pkgJson.main;
|
|
686
686
|
if (mainField === "expo-router/entry") {
|
|
687
|
-
const expoRouterEntry =
|
|
688
|
-
path2.resolve(projectRoot, "node_modules", "expo-router", "entry"),
|
|
689
|
-
ENTRY_EXTENSIONS
|
|
690
|
-
);
|
|
687
|
+
const expoRouterEntry = require.resolve("expo-router/entry");
|
|
691
688
|
if (expoRouterEntry) {
|
|
692
689
|
return expoRouterEntry;
|
|
693
690
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "10.4.0
|
|
3
|
+
"version": "10.4.0",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,10 +45,11 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@storybook/mcp": "^0.6.1",
|
|
48
|
+
"react-native-safe-area-context": "^5",
|
|
48
49
|
"@storybook/react": "^10.3.2",
|
|
49
|
-
"@storybook/react-native-theming": "10.4.0
|
|
50
|
-
"@storybook/react-native-ui": "10.4.0
|
|
51
|
-
"@storybook/react-native-ui-common": "10.4.0
|
|
50
|
+
"@storybook/react-native-theming": "^10.4.0",
|
|
51
|
+
"@storybook/react-native-ui": "^10.4.0",
|
|
52
|
+
"@storybook/react-native-ui-common": "^10.4.0",
|
|
52
53
|
"@tmcp/adapter-valibot": "^0.1.4",
|
|
53
54
|
"@tmcp/transport-http": "^0.8.5",
|
|
54
55
|
"commander": "^14.0.2",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"ws": "^8.20.0"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
|
-
"@types/jest": "^29.
|
|
67
|
+
"@types/jest": "^29.5.13",
|
|
67
68
|
"@types/react": "~19.2.14",
|
|
68
69
|
"babel-jest": "^29.7.0",
|
|
69
70
|
"babel-preset-expo": "^55.0.13",
|
|
@@ -83,7 +84,6 @@
|
|
|
83
84
|
"react-native": ">=0.72.0",
|
|
84
85
|
"react-native-gesture-handler": ">=2",
|
|
85
86
|
"react-native-reanimated": ">=2",
|
|
86
|
-
"react-native-safe-area-context": "*",
|
|
87
87
|
"storybook": ">=10 || ^10"
|
|
88
88
|
},
|
|
89
89
|
"peerDependenciesMeta": {
|
package/readme.md
CHANGED
|
@@ -163,13 +163,13 @@ For projects using [Re.Pack](https://re-pack.dev/) (Rspack/Webpack) instead of M
|
|
|
163
163
|
|
|
164
164
|
## Expo router specific setup
|
|
165
165
|
|
|
166
|
-
```
|
|
166
|
+
```sh
|
|
167
167
|
npm create storybook@latest
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
choose recommended and then native
|
|
171
171
|
|
|
172
|
-
```
|
|
172
|
+
```sh
|
|
173
173
|
npx expo@latest customize metro.config.js
|
|
174
174
|
```
|
|
175
175
|
|
|
@@ -226,7 +226,7 @@ import type { StorybookConfig } from '@storybook/react-native';
|
|
|
226
226
|
|
|
227
227
|
const main: StorybookConfig = {
|
|
228
228
|
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
|
|
229
|
-
|
|
229
|
+
deviceAddons: [],
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
export default main;
|
|
@@ -307,7 +307,7 @@ Currently, the addons available are:
|
|
|
307
307
|
- [`@storybook/addon-ondevice-notes`](https://storybook.js.org/addons/@storybook/addon-ondevice-notes): Add some Markdown to your stories to help document their usage
|
|
308
308
|
- [`@storybook/addon-ondevice-backgrounds`](https://storybook.js.org/addons/@storybook/addon-ondevice-backgrounds): change the background of storybook to compare the look of your component against different backgrounds
|
|
309
309
|
|
|
310
|
-
Install each one you want to use and add them to the `main.ts`
|
|
310
|
+
Install each one you want to use and add them to the `deviceAddons` list in `main.ts` as follows:
|
|
311
311
|
|
|
312
312
|
```ts
|
|
313
313
|
// .rnstorybook/main.ts
|
|
@@ -315,7 +315,7 @@ import type { StorybookConfig } from '@storybook/react-native';
|
|
|
315
315
|
|
|
316
316
|
const main: StorybookConfig = {
|
|
317
317
|
// ... rest of config
|
|
318
|
-
|
|
318
|
+
deviceAddons: [
|
|
319
319
|
'@storybook/addon-ondevice-notes',
|
|
320
320
|
'@storybook/addon-ondevice-controls',
|
|
321
321
|
'@storybook/addon-ondevice-backgrounds',
|
|
@@ -535,7 +535,7 @@ import type { StorybookConfig } from '@storybook/react-native';
|
|
|
535
535
|
|
|
536
536
|
const main: StorybookConfig = {
|
|
537
537
|
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
|
|
538
|
-
|
|
538
|
+
deviceAddons: ['@storybook/addon-ondevice-controls'],
|
|
539
539
|
features: {
|
|
540
540
|
ondeviceBackgrounds: true,
|
|
541
541
|
},
|