@storybook/react-native 8.6.1 → 9.0.0-alpha.1

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
@@ -1,9 +1,9 @@
1
- import * as _storybook_core_types from '@storybook/core/types';
2
- import { StoryIndex, PreparedStory, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, StorybookConfig as StorybookConfig$1 } from '@storybook/core/types';
1
+ import * as storybook_internal_types from 'storybook/internal/types';
2
+ import { StoryIndex, PreparedStory, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, StorybookConfig as StorybookConfig$1 } from 'storybook/internal/types';
3
3
  import { ReactRenderer } from '@storybook/react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { Channel } from '@storybook/core/channels';
6
- import { PreviewWithSelection } from '@storybook/core/preview-api';
5
+ import { Channel } from 'storybook/internal/channels';
6
+ import { PreviewWithSelection } from 'storybook/internal/preview-api';
7
7
  import { StoryContext } from '@storybook/csf';
8
8
  import { Theme } from '@storybook/react-native-theming';
9
9
  export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
@@ -77,11 +77,11 @@ declare function prepareStories({ storyEntries, options, storySort, }: {
77
77
  }): {
78
78
  index: {
79
79
  v: number;
80
- entries: Record<string, _storybook_core_types.IndexEntry>;
80
+ entries: Record<string, storybook_internal_types.IndexEntry>;
81
81
  };
82
82
  importMap: Record<string, any>;
83
83
  };
84
- declare const getProjectAnnotations: (view: View, annotations: any[]) => () => Promise<_storybook_core_types.NormalizedProjectAnnotations<ReactRenderer>>;
84
+ declare const getProjectAnnotations: (view: View, annotations: any[]) => () => Promise<storybook_internal_types.NormalizedProjectAnnotations<ReactRenderer>>;
85
85
  declare function start({ annotations, storyEntries, options, }: {
86
86
  storyEntries: Array<NormalizedStoriesSpecifier & {
87
87
  req: any;
package/dist/index.js CHANGED
@@ -41,17 +41,17 @@ var import_react_native_theming3 = require("@storybook/react-native-theming");
41
41
 
42
42
  // src/Start.tsx
43
43
  var import_react_native4 = require("react-native");
44
- var import_manager_api2 = require("@storybook/core/manager-api");
45
- var import_preview_api2 = require("@storybook/core/preview-api");
44
+ var import_manager_api2 = require("storybook/internal/manager-api");
45
+ var import_preview_api2 = require("storybook/internal/preview-api");
46
46
  var import_csf2 = require("@storybook/csf");
47
- var import_channels2 = require("@storybook/core/channels");
47
+ var import_channels2 = require("storybook/internal/channels");
48
48
 
49
49
  // src/View.tsx
50
50
  var import_bottom_sheet = require("@gorhom/bottom-sheet");
51
- var import_channels = require("@storybook/core/channels");
52
- var import_core_events = __toESM(require("@storybook/core/core-events"));
53
- var import_manager_api = require("@storybook/core/manager-api");
54
- var import_preview_api = require("@storybook/core/preview-api");
51
+ var import_channels = require("storybook/internal/channels");
52
+ var import_core_events = __toESM(require("storybook/internal/core-events"));
53
+ var import_manager_api = require("storybook/internal/manager-api");
54
+ var import_preview_api = require("storybook/internal/preview-api");
55
55
  var import_csf = require("@storybook/csf");
56
56
  var import_react_native_theming2 = require("@storybook/react-native-theming");
57
57
  var import_react_native_ui = require("@storybook/react-native-ui");
@@ -1248,7 +1248,13 @@ function start({
1248
1248
  import_preview_api2.addons.setChannel(channel);
1249
1249
  const previewView = {
1250
1250
  prepareForStory: () => {
1251
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, {});
1251
+ return {
1252
+ component: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, {}),
1253
+ canvasElement: null,
1254
+ mount: () => Promise.resolve({}),
1255
+ storyResult: null,
1256
+ T: null
1257
+ };
1252
1258
  },
1253
1259
  prepareForDocs: () => {
1254
1260
  },
@@ -1269,7 +1275,6 @@ function start({
1269
1275
  },
1270
1276
  showStoryDuringRender: () => {
1271
1277
  }
1272
- // TODO what happened to this type?
1273
1278
  };
1274
1279
  const selectionStore = {
1275
1280
  selection: null,
@@ -1277,6 +1282,7 @@ function start({
1277
1282
  setQueryParams: () => {
1278
1283
  },
1279
1284
  setSelection: (selection) => {
1285
+ console.log("setSelection", selection);
1280
1286
  preview.selectionStore.selection = selection;
1281
1287
  }
1282
1288
  };
@@ -18,7 +18,7 @@ interface WebsocketsOptions {
18
18
  */
19
19
  interface WithStorybookOptions {
20
20
  /**
21
- * The path to the Storybook config folder. Defaults to './.storybook'.
21
+ * The path to the Storybook config folder. Defaults to './.rnstorybook'.
22
22
  */
23
23
  configPath?: string;
24
24
  /**
@@ -56,7 +56,7 @@ interface WithStorybookOptions {
56
56
  *
57
57
  * module.exports = withStorybook(config, {
58
58
  * enabled: true,
59
- * configPath: path.resolve(projectRoot, './.storybook'),
59
+ * configPath: path.resolve(projectRoot, './.rnstorybook'),
60
60
  * websockets: { port: 7007, host: 'localhost' },
61
61
  * useJs: false,
62
62
  * onDisabledRemoveStorybook: true,
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  // scripts/common.js
28
28
  var require_common = __commonJS({
29
29
  "scripts/common.js"(exports2, module2) {
30
- var { globToRegexp, serverRequire } = require("@storybook/core/common");
30
+ var { globToRegexp, serverRequire } = require("storybook/internal/common");
31
31
  var path2 = require("path");
32
32
  var fs = require("fs");
33
33
  var cwd = process.cwd();
@@ -128,7 +128,7 @@ var require_generate = __commonJS({
128
128
  resolveAddonFile,
129
129
  getAddonName
130
130
  } = require_common();
131
- var { normalizeStories, globToRegexp } = require("@storybook/core/common");
131
+ var { normalizeStories, globToRegexp } = require("storybook/internal/common");
132
132
  var fs = require("fs");
133
133
  var prettier = require("prettier");
134
134
  var path2 = require("path");
@@ -301,7 +301,7 @@ function withStorybook(config, options = {
301
301
  });
302
302
  }
303
303
  (0, import_generate.generate)({
304
- configPath: configPath ?? path.resolve(process.cwd(), "./.storybook"),
304
+ configPath: configPath ?? path.resolve(process.cwd(), "./.rnstorybook"),
305
305
  useJs
306
306
  });
307
307
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "8.6.1",
3
+ "version": "9.0.0-alpha.1",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -45,19 +45,18 @@
45
45
  "test:update": "jest --updateSnapshot"
46
46
  },
47
47
  "dependencies": {
48
- "@storybook/core": "^8.6.6",
49
48
  "@storybook/csf": "^0.1.13",
50
49
  "@storybook/global": "^5.0.0",
51
- "@storybook/react": "^8.6.6",
52
- "@storybook/react-native-theming": "^8.6.1",
53
- "@storybook/react-native-ui": "^8.6.1",
50
+ "@storybook/react": "9.0.0-alpha.3",
51
+ "@storybook/react-native-theming": "^9.0.0-alpha.1",
52
+ "@storybook/react-native-ui": "^9.0.0-alpha.1",
54
53
  "commander": "^8.2.0",
55
54
  "dedent": "^1.5.1",
56
55
  "deepmerge": "^4.3.0",
57
56
  "prettier": "^2.4.1",
58
57
  "react-native-url-polyfill": "^2.0.0",
59
58
  "setimmediate": "^1.0.5",
60
- "storybook": "^8.6.6",
59
+ "storybook": "9.0.0-alpha.3",
61
60
  "type-fest": "~2.19",
62
61
  "util": "^0.12.4",
63
62
  "ws": "^8.18.0"
@@ -88,5 +87,5 @@
88
87
  "publishConfig": {
89
88
  "access": "public"
90
89
  },
91
- "gitHead": "3408db3fae500345fdf4913d87c7d31330bc8437"
90
+ "gitHead": "ec42eef3ebdf389ebf9cf669d425712db99f9e37"
92
91
  }
package/scripts/common.js CHANGED
@@ -1,4 +1,4 @@
1
- const { globToRegexp, serverRequire } = require('@storybook/core/common');
1
+ const { globToRegexp, serverRequire } = require('storybook/internal/common');
2
2
  const path = require('path');
3
3
  const fs = require('fs');
4
4
 
@@ -6,7 +6,7 @@ const {
6
6
  resolveAddonFile,
7
7
  getAddonName,
8
8
  } = require('./common');
9
- const { normalizeStories, globToRegexp } = require('@storybook/core/common');
9
+ const { normalizeStories, globToRegexp } = require('storybook/internal/common');
10
10
  const fs = require('fs');
11
11
  const prettier = require('prettier');
12
12
  const path = require('path');
@@ -6,7 +6,7 @@ function getArguments() {
6
6
  .option(
7
7
  '-c, --config-path <path>',
8
8
  'The path to your config folder relative to your project-dir',
9
- './.storybook'
9
+ './.rnstorybook'
10
10
  )
11
11
  .option('-js, --use-js', 'Use a js file for storybook.requires')
12
12
  .option('-a, --absolute', 'Use absolute paths for story imports');
@@ -0,0 +1,53 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
2
+
3
+ import { View } from 'react-native';
4
+ import { fn } from 'storybook/test';
5
+
6
+ import { Button } from './Button';
7
+
8
+ const meta = {
9
+ title: 'Example/Button',
10
+ component: Button,
11
+ decorators: [
12
+ (Story) => (
13
+ <View style={{ flex: 1, alignItems: 'flex-start' }}>
14
+ <Story />
15
+ </View>
16
+ ),
17
+ ],
18
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
19
+ tags: ['autodocs'],
20
+ // Use `fn` to spy on the onPress arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
21
+ args: { onPress: fn() },
22
+ } satisfies Meta<typeof Button>;
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Primary: Story = {
29
+ args: {
30
+ primary: true,
31
+ label: 'Button',
32
+ },
33
+ };
34
+
35
+ export const Secondary: Story = {
36
+ args: {
37
+ label: 'Button',
38
+ },
39
+ };
40
+
41
+ export const Large: Story = {
42
+ args: {
43
+ size: 'large',
44
+ label: 'Button',
45
+ },
46
+ };
47
+
48
+ export const Small: Story = {
49
+ args: {
50
+ size: 'small',
51
+ label: 'Button',
52
+ },
53
+ };
@@ -0,0 +1,101 @@
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
+ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
+
4
+ export interface ButtonProps {
5
+ /** Is this the principal call to action on the page? */
6
+ primary?: boolean;
7
+ /** What background color to use */
8
+ backgroundColor?: string;
9
+ /** How large should the button be? */
10
+ size?: 'small' | 'medium' | 'large';
11
+ /** Button contents */
12
+ label: string;
13
+ /** Optional click handler */
14
+ onPress?: () => void;
15
+ style?: StyleProp<ViewStyle>;
16
+ }
17
+
18
+ /** Primary UI component for user interaction */
19
+ export const Button = ({
20
+ primary = false,
21
+ size = 'medium',
22
+ backgroundColor,
23
+ label,
24
+ style,
25
+ onPress,
26
+ }: ButtonProps) => {
27
+ const modeStyle = primary ? styles.primary : styles.secondary;
28
+ const textModeStyle = primary ? styles.primaryText : styles.secondaryText;
29
+
30
+ const sizeStyle = styles[size];
31
+ const textSizeStyle = textSizeStyles[size];
32
+
33
+ return (
34
+ <TouchableOpacity accessibilityRole="button" activeOpacity={0.6} onPress={onPress}>
35
+ <View
36
+ style={[
37
+ styles.button,
38
+ modeStyle,
39
+ sizeStyle,
40
+ style,
41
+ !!backgroundColor && { backgroundColor },
42
+ { borderColor: 'black' },
43
+ ]}
44
+ >
45
+ <Text style={[textModeStyle, textSizeStyle]}>{label}</Text>
46
+ </View>
47
+ </TouchableOpacity>
48
+ );
49
+ };
50
+
51
+ const styles = StyleSheet.create({
52
+ button: {
53
+ borderWidth: 0,
54
+ borderRadius: 48,
55
+ },
56
+ buttonText: {
57
+ fontWeight: '700',
58
+ lineHeight: 1,
59
+ },
60
+ primary: {
61
+ backgroundColor: '#1ea7fd',
62
+ },
63
+ primaryText: {
64
+ color: 'white',
65
+ },
66
+ secondary: {
67
+ backgroundColor: 'transparent',
68
+ borderColor: 'rgba(0, 0, 0, 0.15)',
69
+ borderWidth: 1,
70
+ },
71
+ secondaryText: {
72
+ color: '#333',
73
+ },
74
+ small: {
75
+ paddingVertical: 10,
76
+ paddingHorizontal: 16,
77
+ },
78
+ smallText: {
79
+ fontSize: 12,
80
+ },
81
+ medium: {
82
+ paddingVertical: 11,
83
+ paddingHorizontal: 20,
84
+ },
85
+ mediumText: {
86
+ fontSize: 14,
87
+ },
88
+ large: {
89
+ paddingVertical: 12,
90
+ paddingHorizontal: 24,
91
+ },
92
+ largeText: {
93
+ fontSize: 16,
94
+ },
95
+ });
96
+
97
+ const textSizeStyles = {
98
+ small: styles.smallText,
99
+ medium: styles.mediumText,
100
+ large: styles.largeText,
101
+ };
@@ -0,0 +1,33 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
2
+
3
+ import { Header } from './Header';
4
+
5
+ const meta = {
6
+ title: 'Example/Header',
7
+ component: Header,
8
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
9
+ tags: ['autodocs'],
10
+ } satisfies Meta<typeof Header>;
11
+
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const LoggedIn: Story = {
17
+ args: {
18
+ user: {
19
+ name: 'Jane Doe',
20
+ },
21
+ onLogin: () => {},
22
+ onLogout: () => {},
23
+ onCreateAccount: () => {},
24
+ },
25
+ };
26
+
27
+ export const LoggedOut: Story = {
28
+ args: {
29
+ onLogin: () => {},
30
+ onLogout: () => {},
31
+ onCreateAccount: () => {},
32
+ },
33
+ };
@@ -0,0 +1,76 @@
1
+ import { StyleSheet, Text, View } from 'react-native';
2
+
3
+ import { Button } from './Button';
4
+
5
+ export type HeaderProps = {
6
+ user?: {};
7
+ onLogin: () => void;
8
+ onLogout: () => void;
9
+ onCreateAccount: () => void;
10
+ };
11
+
12
+ export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => (
13
+ <View>
14
+ <View style={styles.wrapper}>
15
+ <View style={styles.logoContainer}>
16
+ <Text style={styles.h1}>Acme</Text>
17
+ </View>
18
+ <View style={styles.buttonContainer}>
19
+ {user ? (
20
+ <>
21
+ <>
22
+ <Text>Welcome, </Text>
23
+ <Text style={styles.userName}>{user.name}!</Text>
24
+ </>
25
+ <Button style={styles.button} size="small" onPress={onLogout} label="Log out" />
26
+ </>
27
+ ) : (
28
+ <>
29
+ <Button style={styles.button} size="small" onPress={onLogin} label="Log in" />
30
+ <Button
31
+ style={styles.button}
32
+ primary
33
+ size="small"
34
+ onPress={onCreateAccount}
35
+ label="Sign up"
36
+ />
37
+ </>
38
+ )}
39
+ </View>
40
+ </View>
41
+ </View>
42
+ );
43
+
44
+ const styles = StyleSheet.create({
45
+ wrapper: {
46
+ borderBottomWidth: 1,
47
+ borderBottomColor: 'rgba(0, 0, 0, 0.1)',
48
+ paddingVertical: 15,
49
+ paddingHorizontal: 20,
50
+ flexDirection: 'row',
51
+ justifyContent: 'space-between',
52
+ },
53
+ h1: {
54
+ fontWeight: '900',
55
+ fontSize: 20,
56
+ marginTop: 6,
57
+ marginBottom: 6,
58
+ marginLeft: 10,
59
+ color: 'black',
60
+ alignSelf: 'flex-start',
61
+ },
62
+ logoContainer: {
63
+ flexDirection: 'row',
64
+ alignItems: 'center',
65
+ },
66
+ button: {
67
+ marginLeft: 10,
68
+ },
69
+ buttonContainer: {
70
+ flexDirection: 'row',
71
+ alignItems: 'center',
72
+ },
73
+ userName: {
74
+ fontWeight: '700',
75
+ },
76
+ });
@@ -0,0 +1,25 @@
1
+ import type { Meta } from '@storybook/react-native-web-vite';
2
+
3
+ import { expect, userEvent, within } from 'storybook/test';
4
+
5
+ import { Page } from './Page';
6
+
7
+ export default {
8
+ title: 'Example/Page',
9
+ component: Page,
10
+ } as Meta<typeof Page>;
11
+
12
+ export const LoggedIn = {
13
+ play: async ({ canvasElement }) => {
14
+ const canvas = within(canvasElement);
15
+ const loginButton = canvas.getByRole('button', { name: /Log in/i });
16
+ await expect(loginButton).toBeInTheDocument();
17
+ await userEvent.click(loginButton);
18
+ // FIXME: await expect(loginButton).not.toBeInTheDocument();
19
+
20
+ const logoutButton = canvas.getByRole('button', { name: /Log out/i });
21
+ await expect(logoutButton).toBeInTheDocument();
22
+ },
23
+ };
24
+
25
+ export const LoggedOut = {};
@@ -0,0 +1,154 @@
1
+ import { useState } from 'react';
2
+
3
+ import { Linking, StyleSheet, Text, View } from 'react-native';
4
+
5
+ import { Header } from './Header';
6
+
7
+ export const Page = () => {
8
+ const [user, setUser] = useState();
9
+
10
+ return (
11
+ <View>
12
+ <Header
13
+ user={user}
14
+ onLogin={() => setUser({ name: 'Jane Doe' })}
15
+ onLogout={() => setUser(undefined)}
16
+ onCreateAccount={() => setUser({ name: 'Jane Doe' })}
17
+ />
18
+
19
+ <View style={styles.section}>
20
+ <Text role="heading" style={styles.h2}>
21
+ Pages in Storybook
22
+ </Text>
23
+ <Text style={styles.p}>
24
+ We recommend building UIs with a{' '}
25
+ <Text
26
+ style={[styles.a, { fontWeight: 'bold' }]}
27
+ role="link"
28
+ onPress={() => {
29
+ Linking.openURL('https://componentdriven.org');
30
+ }}
31
+ >
32
+ <Text>component-driven</Text>
33
+ </Text>{' '}
34
+ process starting with atomic components and ending with pages.
35
+ </Text>
36
+ <Text style={styles.p}>
37
+ Render pages with mock data. This makes it easy to build and review page states without
38
+ needing to navigate to them in your app. Here are some handy patterns for managing page
39
+ data in Storybook:
40
+ </Text>
41
+ <View>
42
+ <View>
43
+ Use a higher-level connected component. Storybook helps you compose such data from the
44
+ "args" of child component stories
45
+ </View>
46
+ <View>
47
+ Assemble data in the page component from your services. You can mock these services out
48
+ using Storybook.
49
+ </View>
50
+ </View>
51
+ <Text style={styles.p}>
52
+ Get a guided tutorial on component-driven development at{' '}
53
+ <Text
54
+ style={styles.a}
55
+ role="link"
56
+ onPress={() => {
57
+ Linking.openURL('https://storybook.js.org/tutorials/');
58
+ }}
59
+ >
60
+ Storybook tutorials
61
+ </Text>
62
+ . Read more in the{' '}
63
+ <Text
64
+ style={styles.a}
65
+ role="link"
66
+ onPress={() => {
67
+ Linking.openURL('https://storybook.js.org/docs');
68
+ }}
69
+ >
70
+ docs
71
+ </Text>
72
+ .
73
+ </Text>
74
+ <View style={styles.tipWrapper}>
75
+ <View style={styles.tip}>
76
+ <Text style={styles.tipText}>Tip </Text>
77
+ </View>
78
+ <Text>Adjust the width of the canvas with the </Text>
79
+ <Text>Viewports addon in the toolbar</Text>
80
+ </View>
81
+ </View>
82
+ </View>
83
+ );
84
+ };
85
+
86
+ const styles = StyleSheet.create({
87
+ section: {
88
+ fontFamily: "'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif",
89
+ fontSize: 14,
90
+ lineHeight: 24,
91
+ paddingVertical: 48,
92
+ paddingHorizontal: 20,
93
+ marginHorizontal: 'auto',
94
+ maxWidth: 600,
95
+ color: '#333',
96
+ },
97
+
98
+ h2: {
99
+ fontWeight: '900',
100
+ fontSize: 32,
101
+ lineHeight: 1,
102
+ marginBottom: 4,
103
+ },
104
+
105
+ p: {
106
+ marginVertical: 16,
107
+ marginHorizontal: 0,
108
+ },
109
+
110
+ a: {
111
+ color: '#1ea7fd',
112
+ },
113
+
114
+ ul: {
115
+ paddingLeft: 30,
116
+ marginVertical: 16,
117
+ },
118
+
119
+ li: {
120
+ marginBottom: 8,
121
+ },
122
+
123
+ tip: {
124
+ alignSelf: 'flex-start',
125
+ borderRadius: 16,
126
+ backgroundColor: '#e7fdd8',
127
+ paddingVertical: 4,
128
+ paddingHorizontal: 12,
129
+ marginRight: 10,
130
+ marginBottom: 4,
131
+ },
132
+ tipText: {
133
+ fontSize: 11,
134
+ lineHeight: 12,
135
+ fontWeight: '700',
136
+ color: '#66bf3c',
137
+ },
138
+
139
+ tipWrapper: {
140
+ fontSize: 13,
141
+ lineHeight: 20,
142
+ marginTop: 40,
143
+ marginBottom: 40,
144
+ flexDirection: 'row',
145
+ flexWrap: 'wrap',
146
+ },
147
+
148
+ tipWrapperSvg: {
149
+ height: 12,
150
+ width: 12,
151
+ marginRight: 4,
152
+ marginTop: 3,
153
+ },
154
+ });
@@ -8,7 +8,7 @@ import '@storybook/addon-ondevice-actions/register';
8
8
  const normalizedStories = [
9
9
  {
10
10
  titlePrefix: '',
11
- directory: './.storybook/stories',
11
+ directory: './.rnstorybook/stories',
12
12
  files: '**/*.stories.?(ts|tsx|js|jsx)',
13
13
  importPathMatcher:
14
14
  /^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/,
@@ -29,7 +29,7 @@ declare global {
29
29
  const annotations = [
30
30
  require('./preview'),
31
31
  require('@storybook/react-native/dist/preview'),
32
- require('@storybook/addon-actions/preview'),
32
+ require('@storybook/addon-ondevice-actions/preview'),
33
33
  ];
34
34
 
35
35
  global.STORIES = normalizedStories;
@@ -1,33 +0,0 @@
1
- import { View } from 'react-native';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { MyButton } from './Button';
4
-
5
- const meta = {
6
- title: 'MyButton',
7
- component: MyButton,
8
- argTypes: {
9
- onPress: { action: 'pressed the button' },
10
- },
11
- args: {
12
- text: 'Hello world',
13
- },
14
- decorators: [
15
- (Story) => (
16
- <View style={{ padding: 16, alignItems: 'flex-start' }}>
17
- <Story />
18
- </View>
19
- ),
20
- ],
21
- } satisfies Meta<typeof MyButton>;
22
-
23
- export default meta;
24
-
25
- type Story = StoryObj<typeof meta>;
26
-
27
- export const Basic: Story = {};
28
-
29
- export const AnotherExample: Story = {
30
- args: {
31
- text: 'Another example',
32
- },
33
- };
@@ -1,24 +0,0 @@
1
- import { TouchableOpacity, Text, StyleSheet } from 'react-native';
2
-
3
- export type MyButtonProps = {
4
- onPress?: () => void;
5
- text: string;
6
- };
7
-
8
- export const MyButton = ({ onPress, text }: MyButtonProps) => {
9
- return (
10
- <TouchableOpacity style={styles.container} onPress={onPress} activeOpacity={0.8}>
11
- <Text style={styles.text}>{text}</Text>
12
- </TouchableOpacity>
13
- );
14
- };
15
-
16
- const styles = StyleSheet.create({
17
- container: {
18
- paddingHorizontal: 16,
19
- paddingVertical: 8,
20
- backgroundColor: 'purple',
21
- borderRadius: 8,
22
- },
23
- text: { color: 'white' },
24
- });