Skip to content

Commit 782bd0a

Browse files
authored
Merge pull request #30821 from storybookjs/dannyhw/fix-rnw-template
React-Native-Web: Fix errors in CLI template stories
2 parents 45e16a6 + cfc6971 commit 782bd0a

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

code/frameworks/react-native-web-vite/template/cli/js/Header.jsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
1313
<View style={styles.buttonContainer}>
1414
{user ? (
1515
<>
16-
<>
17-
<Text>Welcome, </Text>
18-
<Text style={styles.userName}>{user.name}!</Text>
19-
</>
16+
<Text>Welcome, </Text>
17+
<Text style={styles.userName}>{user.name}!</Text>
18+
2019
<Button style={styles.button} size="small" onPress={onLogout} label="Log out" />
2120
</>
2221
) : (

code/frameworks/react-native-web-vite/template/cli/js/Page.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ export const Page = () => {
4242
</Text>
4343

4444
<View>
45-
<View>
45+
<Text>
4646
Use a higher-level connected component. Storybook helps you compose such data from the
4747
"args" of child component stories
48-
</View>
48+
</Text>
4949

50-
<View>
50+
<Text>
5151
Assemble data in the page component from your services. You can mock these services out
5252
using Storybook.
53-
</View>
53+
</Text>
5454
</View>
5555

5656
<Text style={styles.p}>

code/frameworks/react-native-web-vite/template/cli/ts-4-9/Header.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StyleSheet, Text, View } from 'react-native';
33
import { Button } from './Button';
44

55
export type HeaderProps = {
6-
user?: {};
6+
user?: { name: string };
77
onLogin: () => void;
88
onLogout: () => void;
99
onCreateAccount: () => void;
@@ -18,10 +18,9 @@ export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps
1818
<View style={styles.buttonContainer}>
1919
{user ? (
2020
<>
21-
<>
22-
<Text>Welcome, </Text>
23-
<Text style={styles.userName}>{user.name}!</Text>
24-
</>
21+
<Text>Welcome, </Text>
22+
<Text style={styles.userName}>{user.name}!</Text>
23+
2524
<Button style={styles.button} size="small" onPress={onLogout} label="Log out" />
2625
</>
2726
) : (

code/frameworks/react-native-web-vite/template/cli/ts-4-9/Page.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Linking, StyleSheet, Text, View } from 'react-native';
55
import { Header } from './Header';
66

77
export const Page = () => {
8-
const [user, setUser] = useState();
8+
const [user, setUser] = useState<{ name: string } | undefined>();
99

1010
return (
1111
<View>
@@ -39,14 +39,14 @@ export const Page = () => {
3939
data in Storybook:
4040
</Text>
4141
<View>
42-
<View>
42+
<Text>
4343
Use a higher-level connected component. Storybook helps you compose such data from the
4444
"args" of child component stories
45-
</View>
46-
<View>
45+
</Text>
46+
<Text>
4747
Assemble data in the page component from your services. You can mock these services out
4848
using Storybook.
49-
</View>
49+
</Text>
5050
</View>
5151
<Text style={styles.p}>
5252
Get a guided tutorial on component-driven development at{' '}

0 commit comments

Comments
 (0)