Skip to content

Commit 347d30c

Browse files
authored
fix: only apply story wrapper to full ui (#755)
* fix: only apply story wrapper to full ui * fix
1 parent 5467cf8 commit 347d30c

File tree

111 files changed

+230
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+230
-70
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

examples/expo-example/.maestro/storybook-screenshots.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,160 @@ name: Take screenshots of all Storybook stories
178178
id: 'inputexample-textinput--basic'
179179
- takeScreenshot: '.maestro/screenshots/InputExample-TextInput---Basic'
180180

181+
# Story LoginDocsExample-Button - Disabled
182+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--disabled'
183+
- waitForAnimationToEnd
184+
- assertVisible:
185+
id: 'logindocsexample-button--disabled'
186+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Disabled'
187+
188+
# Story LoginDocsExample-Button - Loading
189+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--loading'
190+
- waitForAnimationToEnd
191+
- assertVisible:
192+
id: 'logindocsexample-button--loading'
193+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Loading'
194+
195+
# Story LoginDocsExample-Button - Long Title
196+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--long-title'
197+
- waitForAnimationToEnd
198+
- assertVisible:
199+
id: 'logindocsexample-button--long-title'
200+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Long-Title'
201+
202+
# Story LoginDocsExample-Button - Primary
203+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--primary'
204+
- waitForAnimationToEnd
205+
- assertVisible:
206+
id: 'logindocsexample-button--primary'
207+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Primary'
208+
209+
# Story LoginDocsExample-Button - Secondary
210+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--secondary'
211+
- waitForAnimationToEnd
212+
- assertVisible:
213+
id: 'logindocsexample-button--secondary'
214+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Secondary'
215+
216+
# Story LoginDocsExample-Button - Secondary Disabled
217+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--secondary-disabled'
218+
- waitForAnimationToEnd
219+
- assertVisible:
220+
id: 'logindocsexample-button--secondary-disabled'
221+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Secondary-Disabled'
222+
223+
# Story LoginDocsExample-Button - Secondary Loading
224+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-button--secondary-loading'
225+
- waitForAnimationToEnd
226+
- assertVisible:
227+
id: 'logindocsexample-button--secondary-loading'
228+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-Button---Secondary-Loading'
229+
230+
# Story LoginDocsExample-LoginForm - Default
231+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-loginform--default'
232+
- waitForAnimationToEnd
233+
- assertVisible:
234+
id: 'logindocsexample-loginform--default'
235+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-LoginForm---Default'
236+
237+
# Story LoginDocsExample-LoginForm - Email Error Only
238+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-loginform--email-error-only'
239+
- waitForAnimationToEnd
240+
- assertVisible:
241+
id: 'logindocsexample-loginform--email-error-only'
242+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-LoginForm---Email-Error-Only'
243+
244+
# Story LoginDocsExample-LoginForm - Loading
245+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-loginform--loading'
246+
- waitForAnimationToEnd
247+
- assertVisible:
248+
id: 'logindocsexample-loginform--loading'
249+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-LoginForm---Loading'
250+
251+
# Story LoginDocsExample-LoginForm - Long Errors
252+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-loginform--long-errors'
253+
- waitForAnimationToEnd
254+
- assertVisible:
255+
id: 'logindocsexample-loginform--long-errors'
256+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-LoginForm---Long-Errors'
257+
258+
# Story LoginDocsExample-LoginForm - Password Error Only
259+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-loginform--password-error-only'
260+
- waitForAnimationToEnd
261+
- assertVisible:
262+
id: 'logindocsexample-loginform--password-error-only'
263+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-LoginForm---Password-Error-Only'
264+
265+
# Story LoginDocsExample-LoginForm - With Errors
266+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-loginform--with-errors'
267+
- waitForAnimationToEnd
268+
- assertVisible:
269+
id: 'logindocsexample-loginform--with-errors'
270+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-LoginForm---With-Errors'
271+
272+
# Story LoginDocsExample-TextInput - Default
273+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--default'
274+
- waitForAnimationToEnd
275+
- assertVisible:
276+
id: 'logindocsexample-textinput--default'
277+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Default'
278+
279+
# Story LoginDocsExample-TextInput - Empty State
280+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--empty-state'
281+
- waitForAnimationToEnd
282+
- assertVisible:
283+
id: 'logindocsexample-textinput--empty-state'
284+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Empty-State'
285+
286+
# Story LoginDocsExample-TextInput - Filled
287+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--filled'
288+
- waitForAnimationToEnd
289+
- assertVisible:
290+
id: 'logindocsexample-textinput--filled'
291+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Filled'
292+
293+
# Story LoginDocsExample-TextInput - Long Error Message
294+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--long-error-message'
295+
- waitForAnimationToEnd
296+
- assertVisible:
297+
id: 'logindocsexample-textinput--long-error-message'
298+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Long-Error-Message'
299+
300+
# Story LoginDocsExample-TextInput - Long Label
301+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--long-label'
302+
- waitForAnimationToEnd
303+
- assertVisible:
304+
id: 'logindocsexample-textinput--long-label'
305+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Long-Label'
306+
307+
# Story LoginDocsExample-TextInput - Password
308+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--password'
309+
- waitForAnimationToEnd
310+
- assertVisible:
311+
id: 'logindocsexample-textinput--password'
312+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Password'
313+
314+
# Story LoginDocsExample-TextInput - Playground
315+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--playground'
316+
- waitForAnimationToEnd
317+
- assertVisible:
318+
id: 'logindocsexample-textinput--playground'
319+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---Playground'
320+
321+
# Story LoginDocsExample-TextInput - With Error
322+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--with-error'
323+
- waitForAnimationToEnd
324+
- assertVisible:
325+
id: 'logindocsexample-textinput--with-error'
326+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---With-Error'
327+
328+
# Story LoginDocsExample-TextInput - With Label
329+
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=logindocsexample-textinput--with-label'
330+
- waitForAnimationToEnd
331+
- assertVisible:
332+
id: 'logindocsexample-textinput--with-label'
333+
- takeScreenshot: '.maestro/screenshots/LoginDocsExample-TextInput---With-Label'
334+
181335
# Story NestingExample-ChatMessage - Message First
182336
- openLink: 'exp://127.0.0.1:8081/--/?STORYBOOK_STORY_ID=nestingexample-chatmessage--message-first'
183337
- waitForAnimationToEnd
Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import AsyncStorage from '@react-native-async-storage/async-storage';
2-
import { theme, ThemeProvider } from '@storybook/react-native-theming';
32
// import { LiteUI } from '@storybook/react-native-ui-lite';
4-
import { SafeAreaView, StatusBar } from 'react-native';
5-
import { SafeAreaProvider } from 'react-native-safe-area-context';
3+
import { SafeAreaView, StatusBar, View } from 'react-native';
4+
65
import { view } from './storybook.requires';
76

87
const isScreenshotTesting = process.env.EXPO_PUBLIC_SCREENSHOT_TESTING === 'true';
@@ -14,44 +13,22 @@ const StorybookUIRoot = view.getStorybookUI({
1413
setItem: AsyncStorage.setItem,
1514
},
1615
enableWebsockets: false,
17-
// onDeviceUI: !isScreenshotTesting,
1816
host: 'localhost',
1917
port: 7007,
20-
// host: '192.x.x.x',
21-
// port: 7007,
22-
23-
// initialSelection: { kind: 'TextInput', name: 'Basic' },
24-
// onDeviceUI: true,
25-
// host: '192.168.1.69',
26-
/* theme: {
27-
brand: {
28-
image: {
29-
uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/512px-React-icon.svg.png',
30-
width: 25,
31-
height: 25,
32-
} ,
33-
},
34-
}, */
3518

36-
onDeviceUI: true,
3719
// CustomUIComponent: LiteUI,
20+
CustomUIComponent: isScreenshotTesting
21+
? ({ children, story }) => {
22+
return (
23+
<SafeAreaView style={{ flex: 1 }}>
24+
<StatusBar hidden />
25+
<View style={{ flex: 1 }} accessibilityLabel={story?.id} testID={story?.id} accessible>
26+
{children}
27+
</View>
28+
</SafeAreaView>
29+
);
30+
}
31+
: undefined,
3832
});
3933

40-
const StorybookUI = () => {
41-
if (isScreenshotTesting) {
42-
return (
43-
<SafeAreaView style={{ flex: 1 }}>
44-
<StatusBar hidden={isScreenshotTesting} />
45-
<SafeAreaProvider style={{ flex: 1 }}>
46-
<ThemeProvider theme={theme}>
47-
<StorybookUIRoot />
48-
</ThemeProvider>
49-
</SafeAreaProvider>
50-
</SafeAreaView>
51-
);
52-
}
53-
54-
return <StorybookUIRoot />;
55-
};
56-
57-
export default StorybookUI;
34+
export default StorybookUIRoot;

packages/react-native-ui/src/Explorer.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Explorer } from './Explorer';
22
import { mockDataset } from './mockdata';
33
import type { RefType } from '@storybook/react-native-ui-common';
44
import { View } from 'react-native';
5+
import { decorators } from './decorators';
56

67
export default {
78
component: Explorer,
@@ -10,6 +11,7 @@ export default {
1011
decorators: [
1112
(storyFn: any) => <View style={{ paddingHorizontal: 20 }}>{storyFn()}</View>,
1213
(storyFn: any) => <View style={{ paddingHorizontal: 20 }}>{storyFn()}</View>,
14+
...decorators,
1315
],
1416
};
1517

packages/react-native-ui/src/Layout.stories.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@ import type { Meta, StoryObj } from '@storybook/react';
22
import { Layout } from './Layout';
33
import { mockDataset } from './mockdata';
44
import { Text, View } from 'react-native';
5-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
6-
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
7-
import { LayoutProvider } from '@storybook/react-native-ui-common';
5+
import { decorators } from './decorators';
86

97
const meta = {
108
component: Layout,
11-
decorators: [
12-
(Story) => (
13-
<GestureHandlerRootView style={{ flex: 1 }}>
14-
<BottomSheetModalProvider>
15-
<LayoutProvider>
16-
<Story />
17-
</LayoutProvider>
18-
</BottomSheetModalProvider>
19-
</GestureHandlerRootView>
20-
),
21-
],
9+
decorators,
2210
} satisfies Meta<typeof Layout>;
2311

2412
export default meta;

packages/react-native-ui/src/SearchResults.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import type { StoryObj, Meta } from '@storybook/react';
22
import { SearchResults } from './SearchResults';
3+
import { decorators } from './decorators';
34

45
const meta = {
56
component: SearchResults,
67
title: 'UI/SearchResults',
8+
decorators,
79
} satisfies Meta<typeof SearchResults>;
810

911
export default meta;

packages/react-native-ui/src/Sidebar.stories.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import React from 'react';
33
import type { IndexHash, State } from 'storybook/internal/manager-api';
4-
import { Button, LayoutProvider, type RefType } from '@storybook/react-native-ui-common';
4+
import { Button, type RefType } from '@storybook/react-native-ui-common';
55
import { Sidebar } from './Sidebar';
66
import { DEFAULT_REF_ID } from './constants';
77
import { mockDataset } from './mockdata';
8+
import { decorators } from './decorators';
89

910
const index = mockDataset.withRoot as IndexHash;
1011
const storyId = 'root-1-child-a2--grandchild-a1-1';
@@ -23,7 +24,7 @@ const meta = {
2324
status: {},
2425
setSelection: () => {},
2526
},
26-
decorators: [(storyFn) => <LayoutProvider>{storyFn()}</LayoutProvider>],
27+
decorators,
2728
} satisfies Meta<typeof Sidebar>;
2829

2930
export default meta;

packages/react-native-ui/src/StorybookLogo.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import type { StoryObj, Meta } from '@storybook/react';
22
import { StorybookLogo } from './StorybookLogo';
33
import { Theme, theme } from '@storybook/react-native-theming';
44
import { Text } from 'react-native';
5+
import { decorators } from './decorators';
56

67
const meta = {
78
component: StorybookLogo,
89
title: 'UI/StorybookLogo',
910
args: {
1011
theme: null,
1112
},
13+
decorators,
1214
} satisfies Meta<typeof StorybookLogo>;
1315

1416
export default meta;

packages/react-native-ui/src/Tree.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { Dataset } from '@storybook/react-native-ui-common';
66
import { index } from './mockdata.large';
77
import { DEFAULT_REF_ID } from './constants';
88
import { ScrollView, Text } from 'react-native';
9+
import { decorators } from './decorators';
910

1011
const customViewports = {
1112
sized: {
@@ -35,6 +36,7 @@ const meta = {
3536
<Story />
3637
</ScrollView>
3738
),
39+
...decorators,
3840
],
3941
} satisfies Meta<typeof Tree>;
4042

packages/react-native-ui/src/TreeNode.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import { ComponentNode, GroupNode, StoryNode } from './TreeNode';
33
import { View } from 'react-native';
4+
import { decorators } from './decorators';
45

56
const meta = {
67
title: 'UI/Sidebar/TreeNode',
78
parameters: { layout: 'fullscreen' },
89
component: StoryNode,
10+
decorators,
911
} satisfies Meta<typeof StoryNode>;
12+
1013
export default meta;
1114

1215
export const Types: StoryObj<typeof meta> = {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
2+
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
3+
import { LayoutProvider } from '@storybook/react-native-ui-common';
4+
import { SafeAreaProvider } from 'react-native-safe-area-context';
5+
import { theme, ThemeProvider } from '@storybook/react-native-theming';
6+
7+
export const decorators = [
8+
(Story) => (
9+
<ThemeProvider theme={theme}>
10+
<SafeAreaProvider>
11+
<GestureHandlerRootView style={{ flex: 1 }}>
12+
<BottomSheetModalProvider>
13+
<LayoutProvider>
14+
<Story />
15+
</LayoutProvider>
16+
</BottomSheetModalProvider>
17+
</GestureHandlerRootView>
18+
</SafeAreaProvider>
19+
</ThemeProvider>
20+
),
21+
];

packages/react-native/src/View.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ export class View {
380380
storage={storage}
381381
theme={appliedTheme as Theme}
382382
>
383-
<StoryView />
383+
<StoryView useWrapper={false} />
384384
</CustomUIComponent>
385385
);
386386
}
@@ -395,11 +395,11 @@ export class View {
395395
self._channel.emit(SET_CURRENT_STORY, { storyId: newStoryId })
396396
}
397397
>
398-
<StoryView />
398+
<StoryView useWrapper={true} />
399399
</FullUI>
400400
);
401401
} else {
402-
return <StoryView />;
402+
return <StoryView useWrapper={false} />;
403403
}
404404
};
405405
};

0 commit comments

Comments
 (0)