@storybook/react-native 6.5.0-rc.8 → 6.5.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/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/preview/View.js +3 -2
- package/dist/preview/components/OnDeviceUI/OnDeviceUI.js +7 -7
- package/dist/preview/components/OnDeviceUI/animation.d.ts +3 -3
- package/dist/preview/components/OnDeviceUI/animation.js +11 -11
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.js +3 -3
- package/dist/preview/components/OnDeviceUI/navigation/constants.d.ts +2 -2
- package/dist/preview/components/OnDeviceUI/navigation/constants.js +2 -2
- package/dist/preview/components/Shared/theme.d.ts +4 -0
- package/dist/preview/components/Shared/theme.js +141 -2
- package/dist/preview/components/StoryListView/StoryListView.js +3 -3
- package/dist/preview/components/StoryView/StoryView.js +4 -3
- package/dist/preview/start.d.ts +2 -2
- package/dist/preview/start.js +4 -4
- package/package.json +2 -2
- package/readme.md +1 -1
- package/dist/types/emotion-native.d.js +0 -4
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export declare const raw: C['raw'];
|
|
|
18
18
|
export declare const storiesOf: (kind: string, _module: NodeModule) => StoryApi<ReactNode>;
|
|
19
19
|
export declare const getStorybookUI: (params?: Partial<import("./preview/View").Params>) => () => JSX.Element;
|
|
20
20
|
export * from './types/types-6.0';
|
|
21
|
+
export { theme, darkTheme } from './preview/components/Shared/theme';
|
package/dist/index.js
CHANGED
package/dist/preview/View.js
CHANGED
|
@@ -15,11 +15,12 @@ import { ThemeProvider } from 'emotion-theming';
|
|
|
15
15
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
16
16
|
import { useSetStoryContext, syncExternalUI } from '../hooks';
|
|
17
17
|
import OnDeviceUI from './components/OnDeviceUI';
|
|
18
|
-
import { theme } from './components/Shared/theme';
|
|
18
|
+
import { darkTheme, theme } from './components/Shared/theme';
|
|
19
19
|
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 { Appearance } from 'react-native';
|
|
23
24
|
import deepmerge from 'deepmerge';
|
|
24
25
|
const STORAGE_KEY = 'lastOpenedStory';
|
|
25
26
|
export class View {
|
|
@@ -89,7 +90,7 @@ export class View {
|
|
|
89
90
|
});
|
|
90
91
|
// eslint-disable-next-line consistent-this
|
|
91
92
|
const self = this;
|
|
92
|
-
const appliedTheme = deepmerge(theme, (_a = params.theme) !== null && _a !== void 0 ? _a : {});
|
|
93
|
+
const appliedTheme = deepmerge(Appearance.getColorScheme() === 'dark' ? darkTheme : theme, (_a = params.theme) !== null && _a !== void 0 ? _a : {});
|
|
93
94
|
// Sync the Storybook parameters (external) with app UI state (internal), to initialise them.
|
|
94
95
|
syncExternalUI({
|
|
95
96
|
isUIVisible: params.isUIHidden !== undefined ? !params.isUIHidden : undefined,
|
|
@@ -8,9 +8,9 @@ import StoryView from '../StoryView';
|
|
|
8
8
|
import AbsolutePositionedKeyboardAwareView from './absolute-positioned-keyboard-aware-view';
|
|
9
9
|
import Addons from './addons/Addons';
|
|
10
10
|
import { AddonsSkeleton } from './addons/AddonsSkeleton';
|
|
11
|
-
import { getAddonPanelPosition,
|
|
11
|
+
import { getAddonPanelPosition, getSidebarPanelPosition, getPreviewShadowStyle, getPreviewStyle, } from './animation';
|
|
12
12
|
import Navigation from './navigation';
|
|
13
|
-
import {
|
|
13
|
+
import { CANVAS, ADDONS } from './navigation/constants';
|
|
14
14
|
import Panel from './Panel';
|
|
15
15
|
import { useWindowDimensions } from 'react-native';
|
|
16
16
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -35,7 +35,7 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
});
|
|
36
36
|
const Container = styled.View(({ theme }) => (Object.assign(Object.assign({ flex: 1, backgroundColor: theme.preview.containerBackgroundColor }, (IS_ANDROID && IS_EXPO ? styles.expoAndroidContainer : undefined)), Platform.select({ web: { overflow: 'hidden' } }))));
|
|
37
37
|
const OnDeviceUI = ({ storyIndex, shouldDisableKeyboardAvoidingView, keyboardAvoidingViewVerticalOffset, tabOpen: initialTabOpen, }) => {
|
|
38
|
-
const [tabOpen, setTabOpen] = useState(initialTabOpen ||
|
|
38
|
+
const [tabOpen, setTabOpen] = useState(initialTabOpen || CANVAS);
|
|
39
39
|
const lastTabOpen = React.useRef(tabOpen);
|
|
40
40
|
const [previewDimensions, setPreviewDimensions] = useState(() => ({
|
|
41
41
|
width: Dimensions.get('window').width,
|
|
@@ -57,7 +57,7 @@ const OnDeviceUI = ({ storyIndex, shouldDisableKeyboardAvoidingView, keyboardAvo
|
|
|
57
57
|
}).start();
|
|
58
58
|
setTabOpen(newTabOpen);
|
|
59
59
|
// close the keyboard opened from a TextInput from story list or knobs
|
|
60
|
-
if (newTabOpen ===
|
|
60
|
+
if (newTabOpen === CANVAS) {
|
|
61
61
|
Keyboard.dismiss();
|
|
62
62
|
}
|
|
63
63
|
}, [tabOpen]);
|
|
@@ -105,7 +105,7 @@ const OnDeviceUI = ({ storyIndex, shouldDisableKeyboardAvoidingView, keyboardAvo
|
|
|
105
105
|
// for the safe area and navigation bar.
|
|
106
106
|
const keyboardVerticalOffset = -panelSafeAreaMargins.paddingBottom + (keyboardAvoidingViewVerticalOffset !== null && keyboardAvoidingViewVerticalOffset !== void 0 ? keyboardAvoidingViewVerticalOffset : 0);
|
|
107
107
|
const [isSplitPanelVisible] = useIsSplitPanelVisible();
|
|
108
|
-
const isPreviewInactive = tabOpen !==
|
|
108
|
+
const isPreviewInactive = tabOpen !== CANVAS;
|
|
109
109
|
return (React.createElement(React.Fragment, null,
|
|
110
110
|
React.createElement(Container, null,
|
|
111
111
|
React.createElement(KeyboardAvoidingView, { enabled: !shouldDisableKeyboardAvoidingView || isPreviewInactive, behavior: IS_IOS ? 'padding' : null, keyboardVerticalOffset: keyboardVerticalOffset, style: flex },
|
|
@@ -116,9 +116,9 @@ const OnDeviceUI = ({ storyIndex, shouldDisableKeyboardAvoidingView, keyboardAvo
|
|
|
116
116
|
isSplitPanelVisible ? (React.createElement(Panel, { edge: "top", style: { flex: 1 } },
|
|
117
117
|
React.createElement(Addons, { active: true }),
|
|
118
118
|
React.createElement(AddonsSkeleton, { visible: isPreviewInactive }))) : null),
|
|
119
|
-
isPreviewInactive ? (React.createElement(TouchableOpacity, { style: StyleSheet.absoluteFillObject, onPress: () => handleToggleTab(
|
|
119
|
+
isPreviewInactive ? (React.createElement(TouchableOpacity, { style: StyleSheet.absoluteFillObject, onPress: () => handleToggleTab(CANVAS) })) : null),
|
|
120
120
|
React.createElement(Panel, { edge: "right", style: [
|
|
121
|
-
|
|
121
|
+
getSidebarPanelPosition(animatedValue.current, previewDimensions.width, wide),
|
|
122
122
|
panelSafeAreaMargins,
|
|
123
123
|
] },
|
|
124
124
|
React.createElement(StoryListView, { storyIndex: storyIndex })),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Animated, Insets } from 'react-native';
|
|
2
2
|
import { PreviewDimens } from './absolute-positioned-keyboard-aware-view';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const getSidebarPanelPosition: (animatedValue: Animated.Value, previewWidth: number, wide: boolean) => {
|
|
4
4
|
transform: {
|
|
5
5
|
translateX: Animated.AnimatedInterpolation<string | number>;
|
|
6
6
|
}[];
|
|
@@ -23,7 +23,7 @@ type PreviewPositionArgs = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Build the animated style for the preview container view.
|
|
25
25
|
*
|
|
26
|
-
* When the
|
|
26
|
+
* When the sidebar or addons panel is focused, the preview container is
|
|
27
27
|
* scaled down and translated to the left (or right) of the panel.
|
|
28
28
|
*/
|
|
29
29
|
export declare const getPreviewStyle: ({ animatedValue, previewDimensions: { width: previewWidth, height: previewHeight }, wide, insets, tabOpen, lastTabOpen, }: PreviewPositionArgs) => {
|
|
@@ -44,7 +44,7 @@ export declare const getPreviewStyle: ({ animatedValue, previewDimensions: { wid
|
|
|
44
44
|
/**
|
|
45
45
|
* Build the animated shadow style for the preview.
|
|
46
46
|
*
|
|
47
|
-
* When the
|
|
47
|
+
* When the sidebar or addons panel are visible the scaled preview will have
|
|
48
48
|
* a shadow, and when going to the preview tab the shadow will be invisible.
|
|
49
49
|
*/
|
|
50
50
|
export declare const getPreviewShadowStyle: (animatedValue: Animated.Value) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { I18nManager } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import { SIDEBAR, CANVAS, ADDONS } from './navigation/constants';
|
|
3
3
|
// Factor that will flip the animation orientation in RTL locales.
|
|
4
4
|
const RTL_SCALE = I18nManager.isRTL ? -1 : 1;
|
|
5
5
|
// Percentage to scale the preview area by when opening a panel.
|
|
@@ -14,13 +14,13 @@ const panelWidth = (width, wide) => {
|
|
|
14
14
|
const scale = wide ? PREVIEW_SCALE_WIDE : PREVIEW_SCALE;
|
|
15
15
|
return width * (1 - scale - SCALE_OFFSET);
|
|
16
16
|
};
|
|
17
|
-
export const
|
|
17
|
+
export const getSidebarPanelPosition = (animatedValue, previewWidth, wide) => {
|
|
18
18
|
return [
|
|
19
19
|
{
|
|
20
20
|
transform: [
|
|
21
21
|
{
|
|
22
22
|
translateX: animatedValue.interpolate({
|
|
23
|
-
inputRange: [
|
|
23
|
+
inputRange: [SIDEBAR, CANVAS],
|
|
24
24
|
outputRange: [0, (-panelWidth(previewWidth, wide) - 1) * RTL_SCALE],
|
|
25
25
|
}),
|
|
26
26
|
},
|
|
@@ -35,7 +35,7 @@ export const getAddonPanelPosition = (animatedValue, previewWidth, wide) => {
|
|
|
35
35
|
transform: [
|
|
36
36
|
{
|
|
37
37
|
translateX: animatedValue.interpolate({
|
|
38
|
-
inputRange: [
|
|
38
|
+
inputRange: [CANVAS, ADDONS],
|
|
39
39
|
outputRange: [
|
|
40
40
|
previewWidth * RTL_SCALE,
|
|
41
41
|
(previewWidth - panelWidth(previewWidth, wide)) * RTL_SCALE,
|
|
@@ -50,7 +50,7 @@ export const getAddonPanelPosition = (animatedValue, previewWidth, wide) => {
|
|
|
50
50
|
/**
|
|
51
51
|
* Build the animated style for the preview container view.
|
|
52
52
|
*
|
|
53
|
-
* When the
|
|
53
|
+
* When the sidebar or addons panel is focused, the preview container is
|
|
54
54
|
* scaled down and translated to the left (or right) of the panel.
|
|
55
55
|
*/
|
|
56
56
|
export const getPreviewStyle = ({ animatedValue, previewDimensions: { width: previewWidth, height: previewHeight }, wide, insets, tabOpen, lastTabOpen, }) => {
|
|
@@ -65,24 +65,24 @@ export const getPreviewStyle = ({ animatedValue, previewDimensions: { width: pre
|
|
|
65
65
|
// safe area inset, then by the preview Y offset.
|
|
66
66
|
const translateY = -(previewHeight / 2 - scaledPreviewHeight / 2) + insets.top + TRANSLATE_Y_OFFSET;
|
|
67
67
|
// Is navigation moving from one panel to another, skipping preview?
|
|
68
|
-
const skipPreview = lastTabOpen !==
|
|
68
|
+
const skipPreview = lastTabOpen !== CANVAS && tabOpen !== CANVAS;
|
|
69
69
|
return {
|
|
70
70
|
transform: [
|
|
71
71
|
{
|
|
72
72
|
translateX: animatedValue.interpolate({
|
|
73
|
-
inputRange: [
|
|
73
|
+
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
74
74
|
outputRange: [translateX, 0, -translateX],
|
|
75
75
|
}),
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
translateY: animatedValue.interpolate({
|
|
79
|
-
inputRange: [
|
|
79
|
+
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
80
80
|
outputRange: [translateY, skipPreview ? translateY : 0, translateY],
|
|
81
81
|
}),
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
scale: animatedValue.interpolate({
|
|
85
|
-
inputRange: [
|
|
85
|
+
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
86
86
|
outputRange: [scale, skipPreview ? scale : 1, scale],
|
|
87
87
|
}),
|
|
88
88
|
},
|
|
@@ -92,14 +92,14 @@ export const getPreviewStyle = ({ animatedValue, previewDimensions: { width: pre
|
|
|
92
92
|
/**
|
|
93
93
|
* Build the animated shadow style for the preview.
|
|
94
94
|
*
|
|
95
|
-
* When the
|
|
95
|
+
* When the sidebar or addons panel are visible the scaled preview will have
|
|
96
96
|
* a shadow, and when going to the preview tab the shadow will be invisible.
|
|
97
97
|
*/
|
|
98
98
|
export const getPreviewShadowStyle = (animatedValue) => ({
|
|
99
99
|
elevation: 8,
|
|
100
100
|
shadowColor: '#000',
|
|
101
101
|
shadowOpacity: animatedValue.interpolate({
|
|
102
|
-
inputRange: [
|
|
102
|
+
inputRange: [SIDEBAR, CANVAS, ADDONS],
|
|
103
103
|
outputRange: [0.25, 0, 0.25],
|
|
104
104
|
}),
|
|
105
105
|
shadowRadius: 8,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
|
-
import {
|
|
3
|
+
import { SIDEBAR, CANVAS, ADDONS } from './constants';
|
|
4
4
|
import { TabBar, TabButton } from '../../Shared/tabs';
|
|
5
5
|
const NavigationTabBar = styled(TabBar)(({ theme }) => ({
|
|
6
6
|
paddingHorizontal: theme.tokens.spacing2,
|
|
@@ -9,6 +9,6 @@ const NavigationTabBar = styled(TabBar)(({ theme }) => ({
|
|
|
9
9
|
borderTopWidth: theme.navigation.borderWidth,
|
|
10
10
|
}));
|
|
11
11
|
export const NavigationBar = React.memo(({ index, onPress, style }) => (React.createElement(NavigationTabBar, { style: style },
|
|
12
|
-
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.
|
|
13
|
-
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.
|
|
12
|
+
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.Sidebar", id: SIDEBAR, active: index === SIDEBAR }, "SIDEBAR"),
|
|
13
|
+
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.Canvas", id: CANVAS, active: index === CANVAS }, "CANVAS"),
|
|
14
14
|
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.Addons", id: ADDONS, active: index === ADDONS }, "ADDONS"))));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const SIDEBAR = -1;
|
|
2
|
+
export declare const CANVAS = 0;
|
|
3
3
|
export declare const ADDONS = 1;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
1
|
+
export const SIDEBAR = -1;
|
|
2
|
+
export const CANVAS = 0;
|
|
3
3
|
export const ADDONS = 1;
|
|
@@ -20,10 +20,13 @@ interface ThemeTokens {
|
|
|
20
20
|
normal: number;
|
|
21
21
|
};
|
|
22
22
|
color: {
|
|
23
|
+
navy: string;
|
|
24
|
+
offBlack: string;
|
|
23
25
|
black: string;
|
|
24
26
|
white: string;
|
|
25
27
|
grey200: string;
|
|
26
28
|
grey700: string;
|
|
29
|
+
grey800: string;
|
|
27
30
|
red500: string;
|
|
28
31
|
blue100: string;
|
|
29
32
|
blue200: string;
|
|
@@ -182,4 +185,5 @@ export interface Theme {
|
|
|
182
185
|
};
|
|
183
186
|
}
|
|
184
187
|
export declare const theme: Theme;
|
|
188
|
+
export declare const darkTheme: Theme;
|
|
185
189
|
export {};
|
|
@@ -11,10 +11,13 @@ const tokens = {
|
|
|
11
11
|
normal: 16,
|
|
12
12
|
},
|
|
13
13
|
color: {
|
|
14
|
-
|
|
14
|
+
navy: '#001a23',
|
|
15
|
+
black: '#000',
|
|
16
|
+
offBlack: '#222',
|
|
15
17
|
white: '#ffffff',
|
|
16
18
|
grey200: '#dee2e3',
|
|
17
19
|
grey700: '#859499',
|
|
20
|
+
grey800: '#575757',
|
|
18
21
|
red500: '#ff4400',
|
|
19
22
|
blue100: '#f6f9fc',
|
|
20
23
|
blue200: '#e0eaf5',
|
|
@@ -42,10 +45,15 @@ const tokens = {
|
|
|
42
45
|
},
|
|
43
46
|
};
|
|
44
47
|
const text = {
|
|
45
|
-
primaryColor: tokens.color.
|
|
48
|
+
primaryColor: tokens.color.navy,
|
|
46
49
|
secondaryColor: tokens.color.grey700,
|
|
47
50
|
linkColor: '#0000ff',
|
|
48
51
|
};
|
|
52
|
+
const textOnDark = {
|
|
53
|
+
primaryColor: tokens.color.white,
|
|
54
|
+
secondaryColor: tokens.color.grey200,
|
|
55
|
+
linkColor: tokens.color.blue600,
|
|
56
|
+
};
|
|
49
57
|
export const theme = {
|
|
50
58
|
tokens,
|
|
51
59
|
text,
|
|
@@ -177,3 +185,134 @@ export const theme = {
|
|
|
177
185
|
},
|
|
178
186
|
},
|
|
179
187
|
};
|
|
188
|
+
export const darkTheme = {
|
|
189
|
+
tokens,
|
|
190
|
+
text: textOnDark,
|
|
191
|
+
backgroundColor: tokens.color.offBlack,
|
|
192
|
+
preview: {
|
|
193
|
+
containerBackgroundColor: tokens.color.black,
|
|
194
|
+
backgroundColor: tokens.color.offBlack,
|
|
195
|
+
},
|
|
196
|
+
navigation: {
|
|
197
|
+
backgroundColor: tokens.color.offBlack,
|
|
198
|
+
borderColor: tokens.color.grey800,
|
|
199
|
+
borderWidth: tokens.borderWidthNormal,
|
|
200
|
+
visibilityBorderRadius: tokens.borderRadius.small,
|
|
201
|
+
visibilityInnerBorderColor: tokens.color.navy,
|
|
202
|
+
visibilityOuterBorderColor: tokens.color.navy,
|
|
203
|
+
},
|
|
204
|
+
panel: {
|
|
205
|
+
backgroundColor: tokens.color.offBlack,
|
|
206
|
+
borderWidth: tokens.borderWidthNormal,
|
|
207
|
+
borderColor: tokens.color.grey800,
|
|
208
|
+
paddingVertical: 0,
|
|
209
|
+
paddingHorizontal: tokens.spacing2,
|
|
210
|
+
},
|
|
211
|
+
storyList: {
|
|
212
|
+
fontSize: tokens.fontSize.normal,
|
|
213
|
+
headerPaddingHorizontal: tokens.spacing2,
|
|
214
|
+
headerPaddingVertical: tokens.spacing2,
|
|
215
|
+
headerTextColor: textOnDark.primaryColor,
|
|
216
|
+
headerFontWeight: '500',
|
|
217
|
+
storyPaddingHorizontal: tokens.spacing2,
|
|
218
|
+
storyPaddingVertical: tokens.spacing1 * 1.5,
|
|
219
|
+
storyIndent: tokens.spacing6,
|
|
220
|
+
storyTextColor: textOnDark.primaryColor,
|
|
221
|
+
storyFontWeight: '400',
|
|
222
|
+
storySelectedBackgroundColor: tokens.color.navy,
|
|
223
|
+
storySelectedTextColor: tokens.color.white,
|
|
224
|
+
storySelectedFontWeight: '700',
|
|
225
|
+
sectionSpacing: tokens.spacing2,
|
|
226
|
+
sectionActiveBackgroundColor: tokens.color.grey800,
|
|
227
|
+
sectionBorderRadius: tokens.borderRadius.medium,
|
|
228
|
+
search: {
|
|
229
|
+
fontSize: tokens.fontSize.normal,
|
|
230
|
+
textColor: textOnDark.primaryColor,
|
|
231
|
+
placeholderTextColor: textOnDark.secondaryColor,
|
|
232
|
+
borderRadius: tokens.borderRadius.round,
|
|
233
|
+
borderColor: tokens.color.grey800,
|
|
234
|
+
borderWidth: tokens.borderWidthNormal,
|
|
235
|
+
backgroundColor: tokens.color.grey800,
|
|
236
|
+
paddingVertical: tokens.spacing2,
|
|
237
|
+
paddingHorizontal: tokens.spacing3,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
button: {
|
|
241
|
+
fontSize: tokens.fontSize.smaller,
|
|
242
|
+
fontWeight: '600',
|
|
243
|
+
paddingVertical: tokens.spacing2,
|
|
244
|
+
paddingHorizontal: tokens.spacing5,
|
|
245
|
+
primary: {
|
|
246
|
+
textColor: textOnDark.primaryColor,
|
|
247
|
+
backgroundColor: tokens.color.black,
|
|
248
|
+
borderColor: tokens.color.blue300,
|
|
249
|
+
borderWidth: tokens.borderWidthNormal,
|
|
250
|
+
borderRadius: tokens.borderRadius.medium,
|
|
251
|
+
},
|
|
252
|
+
secondary: {
|
|
253
|
+
textColor: textOnDark.primaryColor,
|
|
254
|
+
backgroundColor: 'transparent',
|
|
255
|
+
borderColor: tokens.color.blue300,
|
|
256
|
+
borderWidth: tokens.borderWidthNormal,
|
|
257
|
+
borderRadius: tokens.borderRadius.medium,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
tabs: {
|
|
261
|
+
fontSize: tokens.fontSize.small,
|
|
262
|
+
fontWeight: '500',
|
|
263
|
+
paddingVertical: tokens.spacing2,
|
|
264
|
+
paddingHorizontal: tokens.spacing2 * 1.25,
|
|
265
|
+
borderWidth: tokens.borderWidthNormal,
|
|
266
|
+
borderRadius: tokens.borderRadius.round,
|
|
267
|
+
activeBorderColor: tokens.color.blue300,
|
|
268
|
+
activeBackgroundColor: tokens.color.navy,
|
|
269
|
+
activeTextColor: textOnDark.primaryColor,
|
|
270
|
+
inactiveBorderColor: 'transparent',
|
|
271
|
+
inactiveBackgroundColor: 'transparent',
|
|
272
|
+
inactiveTextColor: textOnDark.secondaryColor,
|
|
273
|
+
},
|
|
274
|
+
inputs: {
|
|
275
|
+
errorTextColor: tokens.color.red500,
|
|
276
|
+
labelFontSize: tokens.fontSize.smaller,
|
|
277
|
+
labelTextColor: textOnDark.primaryColor,
|
|
278
|
+
text: {
|
|
279
|
+
fontSize: tokens.fontSize.smaller,
|
|
280
|
+
textColor: textOnDark.primaryColor,
|
|
281
|
+
borderWidth: tokens.borderWidthNormal,
|
|
282
|
+
borderColor: tokens.color.blue400,
|
|
283
|
+
backgroundColor: tokens.color.black,
|
|
284
|
+
borderRadius: tokens.borderRadius.medium,
|
|
285
|
+
paddingVertical: tokens.spacing1 * 1.5,
|
|
286
|
+
paddingHorizontal: tokens.spacing1 * 1.5,
|
|
287
|
+
},
|
|
288
|
+
radio: {
|
|
289
|
+
fontSize: tokens.fontSize.smaller,
|
|
290
|
+
height: 20,
|
|
291
|
+
borderWidth: tokens.borderWidthNormal,
|
|
292
|
+
borderColor: tokens.color.blue400,
|
|
293
|
+
backgroundColor: tokens.color.black,
|
|
294
|
+
paddingVertical: 3,
|
|
295
|
+
paddingHorizontal: 3,
|
|
296
|
+
activeBackgroundColor: tokens.color.green500,
|
|
297
|
+
itemSpacing: tokens.spacing1,
|
|
298
|
+
labelSpacing: tokens.spacing2,
|
|
299
|
+
},
|
|
300
|
+
swatch: {
|
|
301
|
+
fontSize: tokens.fontSize.smaller,
|
|
302
|
+
height: 40,
|
|
303
|
+
borderWidth: tokens.borderWidthNormal,
|
|
304
|
+
borderColor: tokens.color.blue400,
|
|
305
|
+
backgroundColor: tokens.color.navy,
|
|
306
|
+
outerBorderRadius: tokens.borderRadius.medium,
|
|
307
|
+
innerBorderRadius: tokens.borderRadius.small,
|
|
308
|
+
paddingVertical: tokens.spacing1,
|
|
309
|
+
paddingHorizontal: tokens.spacing1,
|
|
310
|
+
nameTextWeight: '600',
|
|
311
|
+
},
|
|
312
|
+
slider: {
|
|
313
|
+
fontSize: tokens.fontSize.smaller,
|
|
314
|
+
labelTextColor: textOnDark.secondaryColor,
|
|
315
|
+
valueTextColor: textOnDark.primaryColor,
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
};
|
|
@@ -36,7 +36,7 @@ const SearchContainer = styled.View(({ theme }) => ({
|
|
|
36
36
|
const SearchBar = (props) => {
|
|
37
37
|
const theme = useTheme();
|
|
38
38
|
return (React.createElement(SearchContainer, null,
|
|
39
|
-
React.createElement(Icon, { name: "search", opacity: 0.5 }),
|
|
39
|
+
React.createElement(Icon, { name: "search", opacity: 0.5, color: 'white' }),
|
|
40
40
|
React.createElement(SearchInput, Object.assign({}, props, { autoCapitalize: "none", autoComplete: "off", autoCorrect: false, spellCheck: false, clearButtonMode: "while-editing", disableFullscreenUI: true, placeholderTextColor: theme.storyList.search.placeholderTextColor, returnKeyType: "search" }))));
|
|
41
41
|
};
|
|
42
42
|
const HeaderContainer = styled.TouchableOpacity({
|
|
@@ -53,7 +53,7 @@ const HeaderContainer = styled.TouchableOpacity({
|
|
|
53
53
|
const SectionHeader = React.memo(({ title, onPress }) => {
|
|
54
54
|
const selected = useIsStorySectionSelected(title);
|
|
55
55
|
return (React.createElement(HeaderContainer, { key: title, selected: selected, onPress: onPress, activeOpacity: 0.8 },
|
|
56
|
-
React.createElement(Icon, { name: "grid", width:
|
|
56
|
+
React.createElement(Icon, { name: "grid", width: 12, height: 12, marginRight: 6 }),
|
|
57
57
|
React.createElement(SectionHeaderText, { selected: selected }, title)));
|
|
58
58
|
});
|
|
59
59
|
const ItemTouchable = styled.TouchableOpacity({
|
|
@@ -74,7 +74,7 @@ const ListItem = React.memo(({ storyId, kind, title, isLastItem, onPress }) => {
|
|
|
74
74
|
const selected = useIsStorySelected(storyId);
|
|
75
75
|
const sectionSelected = useIsStorySectionSelected(kind);
|
|
76
76
|
return (React.createElement(ItemTouchable, { key: title, onPress: onPress, activeOpacity: 0.8, testID: `Storybook.ListItem.${kind}.${title}`, accessibilityLabel: `Storybook.ListItem.${title}`, selected: selected, sectionSelected: sectionSelected, isLastItem: isLastItem },
|
|
77
|
-
React.createElement(Icon, { name: selected ? 'story-white' : 'story-blue', marginRight: 6 }),
|
|
77
|
+
React.createElement(Icon, { width: 14, height: 14, name: selected ? 'story-white' : 'story-blue', marginRight: 6 }),
|
|
78
78
|
React.createElement(StoryNameText, { selected: selected }, title)));
|
|
79
79
|
}, (prevProps, nextProps) => prevProps.storyId === nextProps.storyId);
|
|
80
80
|
const getStories = (storyIndex) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Text, Keyboard } from 'react-native';
|
|
3
|
-
import { useStoryContext } from '../../../hooks';
|
|
3
|
+
import { useStoryContext, useTheme } from '../../../hooks';
|
|
4
4
|
import { Box } from '../Shared/layout';
|
|
5
5
|
/**
|
|
6
6
|
* This is a handler for `onStartShouldSetResponder`, which dismisses the
|
|
@@ -20,11 +20,12 @@ function dismissOnStartResponder() {
|
|
|
20
20
|
const StoryView = () => {
|
|
21
21
|
const context = useStoryContext();
|
|
22
22
|
const id = context === null || context === void 0 ? void 0 : context.id;
|
|
23
|
+
const { backgroundColor } = useTheme();
|
|
23
24
|
if (context && context.unboundStoryFn) {
|
|
24
25
|
const { unboundStoryFn: StoryComponent } = context;
|
|
25
|
-
return (React.createElement(Box, { flex: true, key: id, testID: id, onStartShouldSetResponder: dismissOnStartResponder }, StoryComponent && React.createElement(StoryComponent, Object.assign({}, context))));
|
|
26
|
+
return (React.createElement(Box, { flex: true, key: id, testID: id, onStartShouldSetResponder: dismissOnStartResponder, backgroundColor: backgroundColor }, StoryComponent && React.createElement(StoryComponent, Object.assign({}, context))));
|
|
26
27
|
}
|
|
27
28
|
return (React.createElement(Box, { flex: true, padding: 16, alignItems: "center", justifyContent: "center" },
|
|
28
|
-
React.createElement(Text, null, "Please open
|
|
29
|
+
React.createElement(Text, null, "Please open the sidebar and select a story to preview.")));
|
|
29
30
|
};
|
|
30
31
|
export default React.memo(StoryView);
|
package/dist/preview/start.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="webpack-env" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
import { ClientApi } from '@storybook/client-api';
|
|
3
4
|
import { Loadable } from '@storybook/core-client';
|
|
5
|
+
import type { ArgsStoryFn } from '@storybook/csf';
|
|
4
6
|
import { PreviewWeb } from '@storybook/preview-web';
|
|
5
|
-
import { ClientApi } from '@storybook/client-api';
|
|
6
7
|
import type { ReactNativeFramework } from '../types/types-6.0';
|
|
7
8
|
import { View } from './View';
|
|
8
|
-
import type { ArgsStoryFn } from '@storybook/csf';
|
|
9
9
|
export declare const render: ArgsStoryFn<ReactNativeFramework>;
|
|
10
10
|
export declare function start(): {
|
|
11
11
|
view: View;
|
package/dist/preview/start.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Channel from '@storybook/channels';
|
|
3
1
|
import { addons } from '@storybook/addons';
|
|
2
|
+
import Channel from '@storybook/channels';
|
|
3
|
+
import { ClientApi, setGlobalRender } from '@storybook/client-api';
|
|
4
4
|
import Events from '@storybook/core-events';
|
|
5
5
|
import { PreviewWeb } from '@storybook/preview-web';
|
|
6
|
-
import
|
|
7
|
-
import { View } from './View';
|
|
6
|
+
import React from 'react';
|
|
8
7
|
import { executeLoadableForChanges } from './executeLoadable';
|
|
8
|
+
import { View } from './View';
|
|
9
9
|
export const render = (args, context) => {
|
|
10
10
|
const { id, component: Component } = context;
|
|
11
11
|
if (!Component) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "6.5.0
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "35d882320519d7130219eb060f3aee86caeacd3a"
|
|
91
91
|
}
|
package/readme.md
CHANGED
|
@@ -199,7 +199,7 @@ You can pass these parameters to getStorybookUI call in your storybook entry poi
|
|
|
199
199
|
```
|
|
200
200
|
{
|
|
201
201
|
tabOpen: Number (0)
|
|
202
|
-
-- which tab should be open. -1
|
|
202
|
+
-- which tab should be open. -1 SideBar, 0 Canvas, 1 Addons
|
|
203
203
|
initialSelection: string | Object (undefined)
|
|
204
204
|
-- initialize storybook with a specific story. eg: `mybutton--largebutton` or `{ kind: 'MyButton', name: 'LargeButton' }`
|
|
205
205
|
shouldDisableKeyboardAvoidingView: Boolean (false)
|