@storybook/react-native 7.6.8-alpha.0 → 7.6.10-alpha.0
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/V6.d.ts +12 -6
- package/dist/V6.js +8 -8
- package/dist/View-0aedc31a.d.ts +58 -0
- package/dist/{index.d-82fc9196.d.ts → index.d-cff8c6fa.d.ts} +1 -4
- package/dist/index.d.ts +3 -5
- package/dist/index.js +8 -8
- package/dist/preview.d.ts +1 -1
- package/package.json +18 -17
- package/readme.md +31 -22
- package/dist/View-7a09870e.d.ts +0 -129
package/dist/V6.d.ts
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as Params
|
|
3
|
-
export { C as ComponentMeta, c as ComponentStory, a as ComponentStoryFn, b as ComponentStoryObj, M as Meta, f as Story, d as StoryFn, S as StoryFnReactReturnType, e as StoryObj } from './View-7a09870e.js';
|
|
2
|
+
import { P as Params } from './View-0aedc31a.js';
|
|
4
3
|
import { ClientApi } from '@storybook/preview-api';
|
|
5
|
-
import {
|
|
6
|
-
export { a as ArgTypes, A as Args, P as Parameters, S as StoryContext } from './index.d-82fc9196.js';
|
|
4
|
+
import { L as LoaderFunction, A as Addon_StoryApi } from './index.d-cff8c6fa.js';
|
|
7
5
|
import { ReactNode } from 'react';
|
|
6
|
+
import { ReactRenderer } from '@storybook/react';
|
|
8
7
|
export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
|
|
9
8
|
import '@storybook/csf';
|
|
10
9
|
import '@storybook/preview-web';
|
|
11
10
|
import '@storybook/channels';
|
|
12
11
|
|
|
12
|
+
interface RequireContext {
|
|
13
|
+
keys: () => string[];
|
|
14
|
+
(id: string): any;
|
|
15
|
+
resolve(id: string): string;
|
|
16
|
+
}
|
|
17
|
+
type Loadable = RequireContext | RequireContext[] | LoaderFunction;
|
|
18
|
+
|
|
13
19
|
declare const configure: (loadable: any, m: {
|
|
14
20
|
hot?: {
|
|
15
21
|
accept?: () => void;
|
|
16
22
|
};
|
|
17
23
|
}) => void;
|
|
18
24
|
|
|
19
|
-
type C = ClientApi<
|
|
25
|
+
type C = ClientApi<ReactRenderer>;
|
|
20
26
|
declare const addDecorator: C['addDecorator'];
|
|
21
27
|
declare const addParameters: C['addParameters'];
|
|
22
28
|
declare const addArgsEnhancer: C['addArgsEnhancer'];
|
|
@@ -25,4 +31,4 @@ declare const raw: C['raw'];
|
|
|
25
31
|
declare const storiesOf: (kind: string, m: any) => Addon_StoryApi<ReactNode>;
|
|
26
32
|
declare const getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
27
33
|
|
|
28
|
-
export {
|
|
34
|
+
export { Loadable, RequireContext, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, configure, getStorybookUI, raw, storiesOf };
|
package/dist/V6.js
CHANGED
|
@@ -547,17 +547,16 @@ var createStore = () => {
|
|
|
547
547
|
};
|
|
548
548
|
const mountDependencies = (atom2, atomState, prevDependencies) => {
|
|
549
549
|
const depSet = new Set(atomState.d.keys());
|
|
550
|
+
const maybeUnmountAtomSet = /* @__PURE__ */ new Set();
|
|
550
551
|
prevDependencies == null ? void 0 : prevDependencies.forEach((_, a) => {
|
|
551
552
|
if (depSet.has(a)) {
|
|
552
553
|
depSet.delete(a);
|
|
553
554
|
return;
|
|
554
555
|
}
|
|
556
|
+
maybeUnmountAtomSet.add(a);
|
|
555
557
|
const mounted = mountedMap.get(a);
|
|
556
558
|
if (mounted) {
|
|
557
559
|
mounted.t.delete(atom2);
|
|
558
|
-
if (canUnmountAtom(a, mounted)) {
|
|
559
|
-
unmountAtom(a);
|
|
560
|
-
}
|
|
561
560
|
}
|
|
562
561
|
});
|
|
563
562
|
depSet.forEach((a) => {
|
|
@@ -568,6 +567,12 @@ var createStore = () => {
|
|
|
568
567
|
mountAtom(a, atom2);
|
|
569
568
|
}
|
|
570
569
|
});
|
|
570
|
+
maybeUnmountAtomSet.forEach((a) => {
|
|
571
|
+
const mounted = mountedMap.get(a);
|
|
572
|
+
if (mounted && canUnmountAtom(a, mounted)) {
|
|
573
|
+
unmountAtom(a);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
571
576
|
};
|
|
572
577
|
const flushPending = () => {
|
|
573
578
|
let flushed;
|
|
@@ -667,11 +672,6 @@ if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
|
667
672
|
}
|
|
668
673
|
var getDefaultStore = () => {
|
|
669
674
|
if (!defaultStore) {
|
|
670
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && globalThis.__NUMBER_OF_JOTAI_INSTANCES__ !== 1) {
|
|
671
|
-
console.warn(
|
|
672
|
-
"Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
|
|
673
|
-
);
|
|
674
|
-
}
|
|
675
675
|
defaultStore = createStore();
|
|
676
676
|
}
|
|
677
677
|
return defaultStore;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StoryContext } from '@storybook/csf';
|
|
3
|
+
import { PreviewWithSelection } from '@storybook/preview-web';
|
|
4
|
+
import { Theme } from '@storybook/react-native-theming';
|
|
5
|
+
import { S as StoryIndex } from './index.d-cff8c6fa.js';
|
|
6
|
+
import { ReactRenderer } from '@storybook/react';
|
|
7
|
+
import { Channel } from '@storybook/channels';
|
|
8
|
+
|
|
9
|
+
type StoryKind = string;
|
|
10
|
+
type StoryName = string;
|
|
11
|
+
type InitialSelection = `${StoryKind}--${StoryName}` | {
|
|
12
|
+
/**
|
|
13
|
+
* Kind is the default export name or the storiesOf("name") name
|
|
14
|
+
*/
|
|
15
|
+
kind: StoryKind;
|
|
16
|
+
/**
|
|
17
|
+
* Name is the named export or the .add("name") name
|
|
18
|
+
*/
|
|
19
|
+
name: StoryName;
|
|
20
|
+
};
|
|
21
|
+
type DeepPartial<T> = T extends object ? {
|
|
22
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
23
|
+
} : T;
|
|
24
|
+
type Params = {
|
|
25
|
+
onDeviceUI?: boolean;
|
|
26
|
+
enableWebsockets?: boolean;
|
|
27
|
+
query?: string;
|
|
28
|
+
host?: string;
|
|
29
|
+
port?: number;
|
|
30
|
+
secured?: boolean;
|
|
31
|
+
initialSelection?: InitialSelection;
|
|
32
|
+
shouldPersistSelection?: boolean;
|
|
33
|
+
tabOpen?: number;
|
|
34
|
+
isUIHidden?: boolean;
|
|
35
|
+
isSplitPanelVisible?: boolean;
|
|
36
|
+
shouldDisableKeyboardAvoidingView?: boolean;
|
|
37
|
+
keyboardAvoidingViewVerticalOffset?: number;
|
|
38
|
+
theme: DeepPartial<Theme>;
|
|
39
|
+
};
|
|
40
|
+
declare class View {
|
|
41
|
+
_storyIndex: StoryIndex;
|
|
42
|
+
_setStory: (story: StoryContext<ReactRenderer>) => void;
|
|
43
|
+
_forceRerender: () => void;
|
|
44
|
+
_ready: boolean;
|
|
45
|
+
_preview: PreviewWithSelection<ReactRenderer>;
|
|
46
|
+
_asyncStorageStoryId: string;
|
|
47
|
+
_webUrl: string;
|
|
48
|
+
_channel: Channel;
|
|
49
|
+
constructor(preview: PreviewWithSelection<ReactRenderer>, channel: Channel);
|
|
50
|
+
_getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
|
|
51
|
+
storySpecifier: string;
|
|
52
|
+
viewMode: string;
|
|
53
|
+
}>;
|
|
54
|
+
_getServerChannel: (params?: Partial<Params>) => Channel;
|
|
55
|
+
getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { Params as P, View as V };
|
|
@@ -88,9 +88,6 @@ interface StrictInputType extends InputType {
|
|
|
88
88
|
interface Args {
|
|
89
89
|
[name: string]: any;
|
|
90
90
|
}
|
|
91
|
-
type ArgTypes<TArgs = Args> = {
|
|
92
|
-
[name in keyof TArgs]: InputType;
|
|
93
|
-
};
|
|
94
91
|
type StrictArgTypes<TArgs = Args> = {
|
|
95
92
|
[name in keyof TArgs]: StrictInputType;
|
|
96
93
|
};
|
|
@@ -198,4 +195,4 @@ interface Addon_StoryApi<StoryFnReturnType = unknown> {
|
|
|
198
195
|
}
|
|
199
196
|
type Path = string;
|
|
200
197
|
|
|
201
|
-
export {
|
|
198
|
+
export { Addon_StoryApi as A, LoaderFunction as L, NormalizedStoriesSpecifier as N, Renderer as R, StoryIndex as S, StoryContextForEnhancers as a, Args as b, StrictArgTypes as c };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { V as View } from './View-7a09870e.js';
|
|
2
|
-
export { C as ComponentMeta, c as ComponentStory, a as ComponentStoryFn, b as ComponentStoryObj, M as Meta, R as ReactNativeFramework, f as Story, d as StoryFn, S as StoryFnReactReturnType, e as StoryObj } from './View-7a09870e.js';
|
|
3
1
|
export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { V as View } from './View-0aedc31a.js';
|
|
3
|
+
import { N as NormalizedStoriesSpecifier } from './index.d-cff8c6fa.js';
|
|
6
4
|
import 'react/jsx-runtime';
|
|
7
5
|
import '@storybook/csf';
|
|
8
6
|
import '@storybook/preview-web';
|
|
9
|
-
import 'react';
|
|
7
|
+
import '@storybook/react';
|
|
10
8
|
import '@storybook/channels';
|
|
11
9
|
|
|
12
10
|
declare function start({ annotations, storyEntries, }: {
|
package/dist/index.js
CHANGED
|
@@ -540,17 +540,16 @@ var createStore = () => {
|
|
|
540
540
|
};
|
|
541
541
|
const mountDependencies = (atom2, atomState, prevDependencies) => {
|
|
542
542
|
const depSet = new Set(atomState.d.keys());
|
|
543
|
+
const maybeUnmountAtomSet = /* @__PURE__ */ new Set();
|
|
543
544
|
prevDependencies == null ? void 0 : prevDependencies.forEach((_, a) => {
|
|
544
545
|
if (depSet.has(a)) {
|
|
545
546
|
depSet.delete(a);
|
|
546
547
|
return;
|
|
547
548
|
}
|
|
549
|
+
maybeUnmountAtomSet.add(a);
|
|
548
550
|
const mounted = mountedMap.get(a);
|
|
549
551
|
if (mounted) {
|
|
550
552
|
mounted.t.delete(atom2);
|
|
551
|
-
if (canUnmountAtom(a, mounted)) {
|
|
552
|
-
unmountAtom(a);
|
|
553
|
-
}
|
|
554
553
|
}
|
|
555
554
|
});
|
|
556
555
|
depSet.forEach((a) => {
|
|
@@ -561,6 +560,12 @@ var createStore = () => {
|
|
|
561
560
|
mountAtom(a, atom2);
|
|
562
561
|
}
|
|
563
562
|
});
|
|
563
|
+
maybeUnmountAtomSet.forEach((a) => {
|
|
564
|
+
const mounted = mountedMap.get(a);
|
|
565
|
+
if (mounted && canUnmountAtom(a, mounted)) {
|
|
566
|
+
unmountAtom(a);
|
|
567
|
+
}
|
|
568
|
+
});
|
|
564
569
|
};
|
|
565
570
|
const flushPending = () => {
|
|
566
571
|
let flushed;
|
|
@@ -660,11 +665,6 @@ if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
|
660
665
|
}
|
|
661
666
|
var getDefaultStore = () => {
|
|
662
667
|
if (!defaultStore) {
|
|
663
|
-
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && globalThis.__NUMBER_OF_JOTAI_INSTANCES__ !== 1) {
|
|
664
|
-
console.warn(
|
|
665
|
-
"Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
668
|
defaultStore = createStore();
|
|
669
669
|
}
|
|
670
670
|
return defaultStore;
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _storybook_docs_tools from '@storybook/docs-tools';
|
|
2
|
-
import { R as Renderer,
|
|
2
|
+
import { R as Renderer, a as StoryContextForEnhancers, b as Args, c as StrictArgTypes } from './index.d-cff8c6fa.js';
|
|
3
3
|
|
|
4
4
|
declare const _default: {
|
|
5
5
|
argTypesEnhancers: (<TRenderer extends Renderer>(context: StoryContextForEnhancers<TRenderer, Args>) => StrictArgTypes<Args>)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.10-alpha.0",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -51,39 +51,40 @@
|
|
|
51
51
|
"preset": "react-native"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@storybook/channel-websocket": "7.6.
|
|
55
|
-
"@storybook/channels": "7.6.
|
|
56
|
-
"@storybook/client-logger": "7.6.
|
|
57
|
-
"@storybook/core-client": "7.6.
|
|
58
|
-
"@storybook/core-common": "7.6.
|
|
59
|
-
"@storybook/core-events": "7.6.
|
|
54
|
+
"@storybook/channel-websocket": "^7.6.10",
|
|
55
|
+
"@storybook/channels": "^7.6.10",
|
|
56
|
+
"@storybook/client-logger": "^7.6.10",
|
|
57
|
+
"@storybook/core-client": "^7.6.10",
|
|
58
|
+
"@storybook/core-common": "^7.6.10",
|
|
59
|
+
"@storybook/core-events": "^7.6.10",
|
|
60
60
|
"@storybook/csf": "^0.1.1",
|
|
61
|
-
"@storybook/docs-tools": "7.6.
|
|
61
|
+
"@storybook/docs-tools": "^7.6.10",
|
|
62
62
|
"@storybook/global": "^5.0.0",
|
|
63
|
-
"@storybook/manager-api": "7.6.
|
|
64
|
-
"@storybook/preview-api": "7.6.
|
|
65
|
-
"@storybook/preview-web": "7.6.
|
|
66
|
-
"@storybook/react": "7.6.
|
|
67
|
-
"@storybook/react-native-theming": "^7.6.
|
|
63
|
+
"@storybook/manager-api": "^7.6.10",
|
|
64
|
+
"@storybook/preview-api": "^7.6.10",
|
|
65
|
+
"@storybook/preview-web": "^7.6.10",
|
|
66
|
+
"@storybook/react": "^7.6.10",
|
|
67
|
+
"@storybook/react-native-theming": "^7.6.10-alpha.0",
|
|
68
68
|
"chokidar": "^3.5.1",
|
|
69
69
|
"commander": "^8.2.0",
|
|
70
70
|
"deepmerge": "^4.3.0",
|
|
71
71
|
"glob": "^7.1.7",
|
|
72
72
|
"prettier": "^2.4.1",
|
|
73
73
|
"react-native-swipe-gestures": "^1.0.5",
|
|
74
|
+
"type-fest": "~2.19",
|
|
74
75
|
"util": "^0.12.4"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
|
-
"@storybook/types": "7.6.
|
|
78
|
+
"@storybook/types": "^7.6.10",
|
|
78
79
|
"@types/jest": "^29.4.3",
|
|
79
80
|
"@types/react": "~18.2.14",
|
|
80
81
|
"babel-jest": "^29.4.3",
|
|
81
82
|
"jest": "^29.4.3",
|
|
82
|
-
"jotai": "^2.
|
|
83
|
+
"jotai": "^2.6.2",
|
|
83
84
|
"react-test-renderer": "18.2.0",
|
|
84
85
|
"ts-node": "^10.9.1",
|
|
85
86
|
"tsup": "^7.2.0",
|
|
86
|
-
"typescript": "^5.
|
|
87
|
+
"typescript": "^5.3.3"
|
|
87
88
|
},
|
|
88
89
|
"peerDependencies": {
|
|
89
90
|
"@react-native-async-storage/async-storage": ">=1",
|
|
@@ -97,5 +98,5 @@
|
|
|
97
98
|
"publishConfig": {
|
|
98
99
|
"access": "public"
|
|
99
100
|
},
|
|
100
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "d48243ffb345570962154e0bdf610e3699202bed"
|
|
101
102
|
}
|
package/readme.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
With Storybook for React Native you can design and develop individual React Native components without running your app.
|
|
4
4
|
|
|
5
|
-
This readme is for the 6
|
|
5
|
+
This readme is for the 7.6 version, you can find older versions by browsing the different version tags.
|
|
6
6
|
|
|
7
7
|
For more information about storybook visit: [storybook.js.org](https://storybook.js.org)
|
|
8
8
|
|
|
9
|
-
> NOTE: `@storybook/react-native` requires atleast 6.
|
|
9
|
+
> NOTE: `@storybook/react-native` requires atleast 7.6.9, if you install other storybook core packages they should be `^7.6.9` or newer.
|
|
10
10
|
|
|
11
|
-
If you want to help out or are just curious then check out the [project board](https://github.com/orgs/storybookjs/projects/12) to see the open issues
|
|
11
|
+
If you want to help out or are just curious then check out the [project board](https://github.com/orgs/storybookjs/projects/12) to see the open issues.
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|
|
|
@@ -54,7 +54,7 @@ npx react-native init MyApp --template react-native-template-storybook
|
|
|
54
54
|
Run init to setup your project with all the dependencies and configuration files:
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
|
-
npx sb init --type react_native
|
|
57
|
+
npx sb@latest init --type react_native
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
The only thing left to do is return Storybook's UI in your app entry point (such as `App.js`) like this:
|
|
@@ -67,9 +67,9 @@ If you want to be able to swap easily between storybook and your app, have a loo
|
|
|
67
67
|
|
|
68
68
|
If you want to add everything yourself check out the the manual guide [here](https://github.com/storybookjs/react-native/blob/next/MANUAL_SETUP.md).
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
#### Additional steps: Update your metro config
|
|
71
71
|
|
|
72
|
-
We
|
|
72
|
+
We require the unstable_allowRequireContext transformer option to enable dynamic story imports based on the stories glob in `main.js`. We can also call the storybook generate function from the metro config to automatically generate the `storybook.requires.js` file when metro runs.
|
|
73
73
|
|
|
74
74
|
**Expo**
|
|
75
75
|
|
|
@@ -79,49 +79,59 @@ First create metro config file if you don't have it yet.
|
|
|
79
79
|
npx expo customize metro.config.js
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
Then
|
|
82
|
+
Then set `transformer.unstable_allowRequireContext` to true and add the generate call here.
|
|
83
83
|
|
|
84
|
-
```
|
|
84
|
+
```js
|
|
85
85
|
// metro.config.js
|
|
86
86
|
|
|
87
87
|
const { getDefaultConfig } = require('expo/metro-config');
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const { generate } = require('@storybook/react-native/scripts/generate');
|
|
90
|
+
|
|
91
|
+
generate({
|
|
92
|
+
configPath: path.resolve(__dirname, './.storybook'),
|
|
93
|
+
});
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
const defaultConfig = getDefaultConfig(__dirname);
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
defaultConfig.transformer.unstable_allowRequireContext = true;
|
|
98
|
+
|
|
99
|
+
module.exports = defaultConfig;
|
|
95
100
|
```
|
|
96
101
|
|
|
97
102
|
**React native**
|
|
98
103
|
|
|
99
104
|
```js
|
|
105
|
+
const { generate } = require('@storybook/react-native/scripts/generate');
|
|
106
|
+
|
|
107
|
+
generate({
|
|
108
|
+
configPath: path.resolve(__dirname, './.storybook'),
|
|
109
|
+
});
|
|
110
|
+
|
|
100
111
|
module.exports = {
|
|
101
112
|
/* existing config */
|
|
102
|
-
|
|
103
|
-
|
|
113
|
+
transformer: {
|
|
114
|
+
unstable_allowRequireContext: true,
|
|
104
115
|
},
|
|
105
116
|
};
|
|
106
117
|
```
|
|
107
118
|
|
|
108
119
|
## Writing stories
|
|
109
120
|
|
|
110
|
-
In
|
|
121
|
+
In storybook we use a syntax called CSF that looks like this:
|
|
111
122
|
|
|
112
123
|
```jsx
|
|
113
124
|
import { MyButton } from './Button';
|
|
114
125
|
|
|
115
126
|
export default {
|
|
116
|
-
title: 'components/MyButton',
|
|
117
127
|
component: MyButton,
|
|
118
128
|
};
|
|
119
129
|
|
|
120
|
-
export const Basic =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
export const Basic = {
|
|
131
|
+
args: {
|
|
132
|
+
text: 'Hello World',
|
|
133
|
+
color: 'purple',
|
|
134
|
+
},
|
|
125
135
|
};
|
|
126
136
|
```
|
|
127
137
|
|
|
@@ -167,7 +177,6 @@ For global decorators and parameters, you can add them to `preview.js` inside yo
|
|
|
167
177
|
|
|
168
178
|
```jsx
|
|
169
179
|
// .storybook/preview.js
|
|
170
|
-
|
|
171
180
|
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds';
|
|
172
181
|
export const decorators = [
|
|
173
182
|
withBackgrounds,
|
package/dist/View-7a09870e.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Renderer, Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, StoryContext } from '@storybook/csf';
|
|
3
|
-
import { PreviewWithSelection } from '@storybook/preview-web';
|
|
4
|
-
import { Theme } from '@storybook/react-native-theming';
|
|
5
|
-
import { c as StoryIndex } from './index.d-82fc9196.js';
|
|
6
|
-
import { ReactElement, ComponentType, JSXElementConstructor, ComponentProps } from 'react';
|
|
7
|
-
import { Channel } from '@storybook/channels';
|
|
8
|
-
|
|
9
|
-
type StoryFnReactReturnType = ReactElement<unknown>;
|
|
10
|
-
|
|
11
|
-
interface ReactNativeFramework extends Renderer {
|
|
12
|
-
component: ComponentType<any>;
|
|
13
|
-
storyResult: StoryFnReactReturnType;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* For the common case where a component's stories are simple components that receives args as props:
|
|
17
|
-
*
|
|
18
|
-
* ```tsx
|
|
19
|
-
* export default { ... } as ComponentMeta<typeof Button>;
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
|
|
23
|
-
/**
|
|
24
|
-
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
25
|
-
*
|
|
26
|
-
* ```tsx
|
|
27
|
-
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
|
|
31
|
-
/**
|
|
32
|
-
* For the common case where a (CSFv3) story is a simple component that receives args as props:
|
|
33
|
-
*
|
|
34
|
-
* ```tsx
|
|
35
|
-
* const MyStory: ComponentStory<typeof Button> = {
|
|
36
|
-
* args: { buttonArg1: 'val' },
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
|
|
41
|
-
/**
|
|
42
|
-
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
43
|
-
*
|
|
44
|
-
* ```tsx
|
|
45
|
-
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* NOTE: this is an alias for `ComponentStoryFn`.
|
|
49
|
-
* In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
|
|
50
|
-
*/
|
|
51
|
-
type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;
|
|
52
|
-
/**
|
|
53
|
-
* Metadata to configure the stories for a component.
|
|
54
|
-
*
|
|
55
|
-
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
56
|
-
*/
|
|
57
|
-
type Meta<TArgs = Args> = ComponentAnnotations<ReactNativeFramework, TArgs>;
|
|
58
|
-
/**
|
|
59
|
-
* Story function that represents a CSFv2 component example.
|
|
60
|
-
*
|
|
61
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
62
|
-
*/
|
|
63
|
-
type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactNativeFramework, TArgs>;
|
|
64
|
-
/**
|
|
65
|
-
* Story function that represents a CSFv3 component example.
|
|
66
|
-
*
|
|
67
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
68
|
-
*/
|
|
69
|
-
type StoryObj<TArgs = Args> = StoryAnnotations<ReactNativeFramework, TArgs>;
|
|
70
|
-
/**
|
|
71
|
-
* Story function that represents a CSFv2 component example.
|
|
72
|
-
*
|
|
73
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
74
|
-
*
|
|
75
|
-
* NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
type Story<TArgs = Args> = StoryFn<TArgs>;
|
|
79
|
-
|
|
80
|
-
type StoryKind = string;
|
|
81
|
-
type StoryName = string;
|
|
82
|
-
type InitialSelection = `${StoryKind}--${StoryName}` | {
|
|
83
|
-
/**
|
|
84
|
-
* Kind is the default export name or the storiesOf("name") name
|
|
85
|
-
*/
|
|
86
|
-
kind: StoryKind;
|
|
87
|
-
/**
|
|
88
|
-
* Name is the named export or the .add("name") name
|
|
89
|
-
*/
|
|
90
|
-
name: StoryName;
|
|
91
|
-
};
|
|
92
|
-
type DeepPartial<T> = T extends object ? {
|
|
93
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
94
|
-
} : T;
|
|
95
|
-
type Params = {
|
|
96
|
-
onDeviceUI?: boolean;
|
|
97
|
-
enableWebsockets?: boolean;
|
|
98
|
-
query?: string;
|
|
99
|
-
host?: string;
|
|
100
|
-
port?: number;
|
|
101
|
-
secured?: boolean;
|
|
102
|
-
initialSelection?: InitialSelection;
|
|
103
|
-
shouldPersistSelection?: boolean;
|
|
104
|
-
tabOpen?: number;
|
|
105
|
-
isUIHidden?: boolean;
|
|
106
|
-
isSplitPanelVisible?: boolean;
|
|
107
|
-
shouldDisableKeyboardAvoidingView?: boolean;
|
|
108
|
-
keyboardAvoidingViewVerticalOffset?: number;
|
|
109
|
-
theme: DeepPartial<Theme>;
|
|
110
|
-
};
|
|
111
|
-
declare class View {
|
|
112
|
-
_storyIndex: StoryIndex;
|
|
113
|
-
_setStory: (story: StoryContext<ReactNativeFramework>) => void;
|
|
114
|
-
_forceRerender: () => void;
|
|
115
|
-
_ready: boolean;
|
|
116
|
-
_preview: PreviewWithSelection<ReactNativeFramework>;
|
|
117
|
-
_asyncStorageStoryId: string;
|
|
118
|
-
_webUrl: string;
|
|
119
|
-
_channel: Channel;
|
|
120
|
-
constructor(preview: PreviewWithSelection<ReactNativeFramework>, channel: Channel);
|
|
121
|
-
_getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
|
|
122
|
-
storySpecifier: string;
|
|
123
|
-
viewMode: string;
|
|
124
|
-
}>;
|
|
125
|
-
_getServerChannel: (params?: Partial<Params>) => Channel;
|
|
126
|
-
getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export { ComponentMeta as C, Meta as M, Params as P, ReactNativeFramework as R, StoryFnReactReturnType as S, View as V, ComponentStoryFn as a, ComponentStoryObj as b, ComponentStory as c, StoryFn as d, StoryObj as e, Story as f };
|