@storybook/react-native 6.5.2 → 6.5.3
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/preview/View.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import React, { useEffect, useReducer } from 'react';
|
|
10
|
+
import React, { useEffect, useMemo, useReducer } from 'react';
|
|
11
11
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
12
12
|
import { toId } from '@storybook/csf';
|
|
13
13
|
import { addons } from '@storybook/addons';
|
|
@@ -20,7 +20,7 @@ import StoryView from './components/StoryView';
|
|
|
20
20
|
import createChannel from '@storybook/channel-websocket';
|
|
21
21
|
import getHost from './rn-host-detect';
|
|
22
22
|
import events from '@storybook/core-events';
|
|
23
|
-
import {
|
|
23
|
+
import { useColorScheme } from 'react-native';
|
|
24
24
|
import deepmerge from 'deepmerge';
|
|
25
25
|
const STORAGE_KEY = 'lastOpenedStory';
|
|
26
26
|
export class View {
|
|
@@ -67,7 +67,6 @@ export class View {
|
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
69
|
this.getStorybookUI = (params = {}) => {
|
|
70
|
-
var _a;
|
|
71
70
|
const { shouldPersistSelection = true, onDeviceUI = true, enableWebsockets = false } = params;
|
|
72
71
|
const initialStory = this._getInitialStory(params);
|
|
73
72
|
if (enableWebsockets) {
|
|
@@ -90,7 +89,6 @@ export class View {
|
|
|
90
89
|
});
|
|
91
90
|
// eslint-disable-next-line consistent-this
|
|
92
91
|
const self = this;
|
|
93
|
-
const appliedTheme = deepmerge(Appearance.getColorScheme() === 'dark' ? darkTheme : theme, (_a = params.theme) !== null && _a !== void 0 ? _a : {});
|
|
94
92
|
// Sync the Storybook parameters (external) with app UI state (internal), to initialise them.
|
|
95
93
|
syncExternalUI({
|
|
96
94
|
isUIVisible: params.isUIHidden !== undefined ? !params.isUIHidden : undefined,
|
|
@@ -98,7 +96,12 @@ export class View {
|
|
|
98
96
|
});
|
|
99
97
|
return () => {
|
|
100
98
|
const setContext = useSetStoryContext();
|
|
99
|
+
const colorScheme = useColorScheme();
|
|
101
100
|
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
101
|
+
const appliedTheme = useMemo(() => {
|
|
102
|
+
var _a;
|
|
103
|
+
return deepmerge(colorScheme === 'dark' ? darkTheme : theme, (_a = params.theme) !== null && _a !== void 0 ? _a : {});
|
|
104
|
+
}, [colorScheme]);
|
|
102
105
|
useEffect(() => {
|
|
103
106
|
self._setStory = (newStory) => {
|
|
104
107
|
setContext(newStory);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.3",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"template/**/*"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
+
"dev": "yarn tsc --watch",
|
|
35
36
|
"preprepare": "rm -rf dist/",
|
|
36
37
|
"prepare": "tsc",
|
|
37
38
|
"test": "jest"
|
|
@@ -87,5 +88,5 @@
|
|
|
87
88
|
"publishConfig": {
|
|
88
89
|
"access": "public"
|
|
89
90
|
},
|
|
90
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "464967fd130b46df44f91395d08e6a25afa36679"
|
|
91
92
|
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/* do not change this file, it is auto generated by storybook. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
configure,
|
|
5
|
-
addDecorator,
|
|
6
|
-
addParameters,
|
|
7
|
-
addArgsEnhancer,
|
|
8
|
-
clearDecorators,
|
|
9
|
-
} from '@storybook/react-native';
|
|
10
|
-
|
|
11
|
-
import '@storybook/addon-ondevice-controls/register';
|
|
12
|
-
import '@storybook/addon-ondevice-actions/register';
|
|
13
|
-
|
|
14
|
-
import { argsEnhancers } from '@storybook/addon-actions/dist/modern/preset/addArgs';
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line import/named
|
|
17
|
-
import { decorators, parameters } from './preview';
|
|
18
|
-
|
|
19
|
-
global.STORIES = [
|
|
20
|
-
{
|
|
21
|
-
titlePrefix: '',
|
|
22
|
-
directory: './.storybook/stories',
|
|
23
|
-
files: '**/*.stories.?(ts|tsx|js|jsx)',
|
|
24
|
-
importPathMatcher:
|
|
25
|
-
'^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$',
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
if (decorators) {
|
|
30
|
-
// eslint-disable-next-line no-undef
|
|
31
|
-
if (__DEV__) {
|
|
32
|
-
// stops the warning from showing on every HMR
|
|
33
|
-
require('react-native').LogBox.ignoreLogs([
|
|
34
|
-
'`clearDecorators` is deprecated and will be removed in Storybook 7.0',
|
|
35
|
-
]);
|
|
36
|
-
}
|
|
37
|
-
// workaround for global decorators getting infinitely applied on HMR, see https://github.com/storybookjs/react-native/issues/185
|
|
38
|
-
clearDecorators();
|
|
39
|
-
decorators.forEach((decorator) => addDecorator(decorator));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (parameters) {
|
|
43
|
-
addParameters(parameters);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
argsEnhancers.forEach((enhancer) => addArgsEnhancer(enhancer));
|
|
48
|
-
} catch {
|
|
49
|
-
/* workaround for occasional crash */
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const getStories = () => {
|
|
53
|
-
return {
|
|
54
|
-
'./.storybook/stories/Button/Button.stories.js': require('./stories/Button/Button.stories.js'),
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
configure(getStories, module, false);
|