Skip to content

Commit d7a84be

Browse files
committed
fix: add requires file to git to simplify setup
1 parent 20b6535 commit d7a84be

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ htpasswd
2929
storybook-out
3030
/addons/docs/common/config-*
3131
built-storybooks
32-
examples/expo-example/.storybook/storybook.requires.js
3332
.yarn/*
3433
!.yarn/patches
3534
!.yarn/plugins
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* do not change this file, it is auto generated by storybook. */
2+
3+
import {
4+
configure,
5+
addDecorator,
6+
addParameters,
7+
addArgsEnhancer,
8+
clearDecorators,
9+
} from "@storybook/react-native";
10+
11+
global.STORIES = [
12+
{
13+
titlePrefix: "",
14+
directory: "./components",
15+
files: "**/*.stories.?(ts|tsx|js|jsx)",
16+
importPathMatcher:
17+
"^\\.[\\\\/](?:components(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$",
18+
},
19+
{
20+
titlePrefix: "",
21+
directory: "./other_components/AnotherButton",
22+
files: "AnotherButton.stories.tsx",
23+
importPathMatcher:
24+
"^\\.[\\\\/](?:other_components\\/AnotherButton\\/AnotherButton\\.stories\\.tsx)$",
25+
},
26+
];
27+
28+
import "@storybook/addon-ondevice-notes/register";
29+
import "@storybook/addon-ondevice-controls/register";
30+
import "@storybook/addon-ondevice-knobs/register";
31+
import "@storybook/addon-ondevice-backgrounds/register";
32+
import "@storybook/addon-ondevice-actions/register";
33+
34+
import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs";
35+
36+
import { decorators, parameters } from "./preview";
37+
38+
if (decorators) {
39+
if (__DEV__) {
40+
// stops the warning from showing on every HMR
41+
require("react-native").LogBox.ignoreLogs([
42+
"`clearDecorators` is deprecated and will be removed in Storybook 7.0",
43+
]);
44+
}
45+
// workaround for global decorators getting infinitely applied on HMR, see https://github.com/storybookjs/react-native/issues/185
46+
clearDecorators();
47+
decorators.forEach((decorator) => addDecorator(decorator));
48+
}
49+
50+
if (parameters) {
51+
addParameters(parameters);
52+
}
53+
54+
try {
55+
argsEnhancers.forEach((enhancer) => addArgsEnhancer(enhancer));
56+
} catch {}
57+
58+
const stories = [
59+
require.context(
60+
"../components",
61+
true,
62+
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/
63+
),
64+
require.context(
65+
"../other_components/AnotherButton",
66+
false,
67+
/^\.[\\/](?:AnotherButton\.stories\.tsx)$/
68+
),
69+
];
70+
71+
configure(stories, module, false);

0 commit comments

Comments
 (0)