@storybook/react-native 9.0.0-alpha.1 → 9.0.0-alpha.2
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 +0 -1
- package/package.json +4 -4
- package/template/cli/stories/Button.stories.tsx +1 -1
- package/template/cli/stories/Header.stories.tsx +1 -1
- package/template/cli/stories/Header.tsx +5 -5
- package/template/cli/stories/Page.stories.tsx +2 -17
- package/template/cli/stories/Page.tsx +5 -12
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.2",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"@storybook/csf": "^0.1.13",
|
|
49
49
|
"@storybook/global": "^5.0.0",
|
|
50
50
|
"@storybook/react": "9.0.0-alpha.3",
|
|
51
|
-
"@storybook/react-native-theming": "^9.0.0-alpha.
|
|
52
|
-
"@storybook/react-native-ui": "^9.0.0-alpha.
|
|
51
|
+
"@storybook/react-native-theming": "^9.0.0-alpha.2",
|
|
52
|
+
"@storybook/react-native-ui": "^9.0.0-alpha.2",
|
|
53
53
|
"commander": "^8.2.0",
|
|
54
54
|
"dedent": "^1.5.1",
|
|
55
55
|
"deepmerge": "^4.3.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "306eab6786b68126ca761c58dca49ec0c76cb374"
|
|
91
91
|
}
|
|
@@ -3,7 +3,7 @@ import { StyleSheet, Text, View } from 'react-native';
|
|
|
3
3
|
import { Button } from './Button';
|
|
4
4
|
|
|
5
5
|
export type HeaderProps = {
|
|
6
|
-
user?: {};
|
|
6
|
+
user?: { name: string };
|
|
7
7
|
onLogin: () => void;
|
|
8
8
|
onLogout: () => void;
|
|
9
9
|
onCreateAccount: () => void;
|
|
@@ -18,15 +18,15 @@ export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps
|
|
|
18
18
|
<View style={styles.buttonContainer}>
|
|
19
19
|
{user ? (
|
|
20
20
|
<>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</>
|
|
21
|
+
<Text>Welcome, </Text>
|
|
22
|
+
<Text style={styles.userName}>{user.name}!</Text>
|
|
23
|
+
|
|
25
24
|
<Button style={styles.button} size="small" onPress={onLogout} label="Log out" />
|
|
26
25
|
</>
|
|
27
26
|
) : (
|
|
28
27
|
<>
|
|
29
28
|
<Button style={styles.button} size="small" onPress={onLogin} label="Log in" />
|
|
29
|
+
|
|
30
30
|
<Button
|
|
31
31
|
style={styles.button}
|
|
32
32
|
primary
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Meta } from '@storybook/react
|
|
2
|
-
|
|
3
|
-
import { expect, userEvent, within } from 'storybook/test';
|
|
1
|
+
import type { Meta } from '@storybook/react';
|
|
4
2
|
|
|
5
3
|
import { Page } from './Page';
|
|
6
4
|
|
|
@@ -9,17 +7,4 @@ export default {
|
|
|
9
7
|
component: Page,
|
|
10
8
|
} as Meta<typeof Page>;
|
|
11
9
|
|
|
12
|
-
export const
|
|
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 = {};
|
|
10
|
+
export const Default = {};
|
|
@@ -5,7 +5,7 @@ import { Linking, StyleSheet, Text, View } from 'react-native';
|
|
|
5
5
|
import { Header } from './Header';
|
|
6
6
|
|
|
7
7
|
export const Page = () => {
|
|
8
|
-
const [user, setUser] = useState();
|
|
8
|
+
const [user, setUser] = useState<{ name: string } | undefined>();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<View>
|
|
@@ -39,14 +39,14 @@ export const Page = () => {
|
|
|
39
39
|
data in Storybook:
|
|
40
40
|
</Text>
|
|
41
41
|
<View>
|
|
42
|
-
<
|
|
42
|
+
<Text>
|
|
43
43
|
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
44
44
|
"args" of child component stories
|
|
45
|
-
</
|
|
46
|
-
<
|
|
45
|
+
</Text>
|
|
46
|
+
<Text>
|
|
47
47
|
Assemble data in the page component from your services. You can mock these services out
|
|
48
48
|
using Storybook.
|
|
49
|
-
</
|
|
49
|
+
</Text>
|
|
50
50
|
</View>
|
|
51
51
|
<Text style={styles.p}>
|
|
52
52
|
Get a guided tutorial on component-driven development at{' '}
|
|
@@ -71,13 +71,6 @@ export const Page = () => {
|
|
|
71
71
|
</Text>
|
|
72
72
|
.
|
|
73
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
74
|
</View>
|
|
82
75
|
</View>
|
|
83
76
|
);
|