File tree Expand file tree Collapse file tree 8 files changed +547
-121
lines changed Expand file tree Collapse file tree 8 files changed +547
-121
lines changed Original file line number Diff line number Diff line change 1
- import { getStorybookUI } from '@storybook/react-native' ;
2
- import './storybook.requires' ;
1
+ // .storybook/index.tsx
2
+ import { view } from './storybook.requires' ;
3
+ import AsyncStorage from '@react-native-async-storage/async-storage' ;
3
4
4
- const StorybookUIRoot = getStorybookUI ( {
5
- // options go here
5
+ const StorybookUIRoot = view . getStorybookUI ( {
6
+ storage : {
7
+ getItem : AsyncStorage . getItem ,
8
+ setItem : AsyncStorage . setItem ,
9
+ } ,
6
10
} ) ;
7
11
8
- export default StorybookUIRoot
12
+ export default StorybookUIRoot ;
Original file line number Diff line number Diff line change @@ -3,5 +3,10 @@ module.exports = {
3
3
"../src/components/**/*.stories.?(ts|tsx|js|jsx)" ,
4
4
"../src/screens/**/*.stories.?(ts|tsx|js|jsx)" ,
5
5
] ,
6
- addons : [ "@storybook/addon-ondevice-controls" ] ,
6
+ addons : [
7
+ '@storybook/addon-ondevice-notes' ,
8
+ '@storybook/addon-ondevice-controls' ,
9
+ '@storybook/addon-ondevice-backgrounds' ,
10
+ '@storybook/addon-ondevice-actions' ,
11
+ ] ,
7
12
} ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /* do not change this file, it is auto generated by storybook. */
2
+
3
+ import { start } from "@storybook/react-native" ;
4
+
5
+ import "@storybook/addon-ondevice-notes/register" ;
6
+ import "@storybook/addon-ondevice-controls/register" ;
7
+ import "@storybook/addon-ondevice-backgrounds/register" ;
8
+ import "@storybook/addon-ondevice-actions/register" ;
9
+
10
+ const normalizedStories = [
11
+ {
12
+ titlePrefix : "" ,
13
+ directory : "./src/components" ,
14
+ files : "**/*.stories.?(ts|tsx|js|jsx)" ,
15
+ importPathMatcher :
16
+ / ^ \. (?: (?: ^ | \/ | (?: (?: (? ! (?: ^ | \/ ) \. ) .) * ?) \/ ) (? ! \. ) (? = .) [ ^ / ] * ?\. s t o r i e s \. (?: t s | t s x | j s | j s x ) ? ) $ / ,
17
+ // @ts -ignore
18
+ req : require . context (
19
+ "../src/components" ,
20
+ true ,
21
+ / ^ \. (?: (?: ^ | \/ | (?: (?: (? ! (?: ^ | \/ ) \. ) .) * ?) \/ ) (? ! \. ) (? = .) [ ^ / ] * ?\. s t o r i e s \. (?: t s | t s x | j s | j s x ) ? ) $ /
22
+ ) ,
23
+ } ,
24
+ {
25
+ titlePrefix : "" ,
26
+ directory : "./src/screens" ,
27
+ files : "**/*.stories.?(ts|tsx|js|jsx)" ,
28
+ importPathMatcher :
29
+ / ^ \. (?: (?: ^ | \/ | (?: (?: (? ! (?: ^ | \/ ) \. ) .) * ?) \/ ) (? ! \. ) (? = .) [ ^ / ] * ?\. s t o r i e s \. (?: t s | t s x | j s | j s x ) ? ) $ / ,
30
+ // @ts -ignore
31
+ req : require . context (
32
+ "../src/screens" ,
33
+ true ,
34
+ / ^ \. (?: (?: ^ | \/ | (?: (?: (? ! (?: ^ | \/ ) \. ) .) * ?) \/ ) (? ! \. ) (? = .) [ ^ / ] * ?\. s t o r i e s \. (?: t s | t s x | j s | j s x ) ? ) $ /
35
+ ) ,
36
+ } ,
37
+ ] ;
38
+
39
+ // @ts -ignore
40
+ global . STORIES = normalizedStories ;
41
+
42
+ export const view = start ( {
43
+ annotations : [
44
+ require ( "./preview" ) ,
45
+ require ( "@storybook/react-native/dist/preview" ) ,
46
+ require ( "@storybook/addon-actions/preview" ) ,
47
+ ] ,
48
+ storyEntries : normalizedStories ,
49
+ } ) ;
Original file line number Diff line number Diff line change 1
- // Learn more https://docs.expo.io/guides/customizing-metro
2
- const { getDefaultConfig } = require ( "expo/metro-config" ) ;
1
+ // metro.config.js
2
+ const path = require ( 'path' ) ;
3
+ const { getDefaultConfig } = require ( 'expo/metro-config' ) ;
3
4
4
- const defaultConfig = getDefaultConfig ( __dirname ) ;
5
+ const { generate } = require ( '@storybook/react-native/scripts/generate' ) ;
5
6
6
- defaultConfig . resolver . resolverMainFields . unshift ( "sbmodern" ) ;
7
+ generate ( {
8
+ configPath : path . resolve ( __dirname , './.storybook' ) ,
9
+ } ) ;
7
10
8
- module . exports = defaultConfig ;
11
+ /** @type {import('expo/metro-config').MetroConfig } */
12
+ const config = getDefaultConfig ( __dirname ) ;
13
+
14
+ config . transformer . unstable_allowRequireContext = true ;
15
+
16
+ config . resolver . sourceExts . push ( 'mjs' ) ;
17
+
18
+ module . exports = config ;
Original file line number Diff line number Diff line change 64
64
"@react-native-community/datetimepicker" : " 7.6.2" ,
65
65
"@react-native-community/slider" : " 4.5.0" ,
66
66
"@storybook/addon-controls" : " ^7.6.10" ,
67
- "@storybook/addon-ondevice-controls" : " ^6.5.1" ,
67
+ "@storybook/addon-ondevice-actions" : " ^7.6.15" ,
68
+ "@storybook/addon-ondevice-backgrounds" : " ^7.6.15" ,
69
+ "@storybook/addon-ondevice-controls" : " ^7.6.15" ,
70
+ "@storybook/addon-ondevice-notes" : " ^7.6.15" ,
68
71
"@storybook/addons" : " ^7.6.10" ,
69
72
"@storybook/core-common" : " ^7.6.10" ,
70
- "@storybook/react-native" : " ^6.5.1 " ,
73
+ "@storybook/react-native" : " ^7.6.15 " ,
71
74
"@storybook/react-native-server" : " ^6.5.8" ,
72
75
"@tanstack/eslint-plugin-query" : " ^5.17.20" ,
73
76
"@testing-library/jest-native" : " ^5.4.3" ,
Original file line number Diff line number Diff line change @@ -30,6 +30,4 @@ export const NotForSale = () => (
30
30
</ NavigationContainer >
31
31
) ;
32
32
33
- NotForSale . story = {
34
- name : "Not for sale" ,
35
- } ;
33
+ NotForSale . storyName = "Not for sale" ;
You can’t perform that action at this time.
0 commit comments