@storybook/react-native-ui 10.2.3 → 10.3.0-canary-20260217005118

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/index.d.ts CHANGED
@@ -108,9 +108,10 @@ interface SidebarProps extends API_LoadedRefData {
108
108
  declare const Sidebar: React.NamedExoticComponent<SidebarProps>;
109
109
 
110
110
  declare const FullUI: SBUI;
111
- declare const Layout: ({ storyHash, story, children, }: {
111
+ declare const Layout: ({ storyHash, story, storyBackgroundColor, children, }: {
112
112
  storyHash: API_IndexHash | undefined;
113
113
  story?: StoryContext<ReactRenderer, Args>;
114
+ storyBackgroundColor?: string;
114
115
  children: ReactNode | ReactNode[];
115
116
  }) => react_jsx_runtime.JSX.Element;
116
117
 
package/dist/index.js CHANGED
@@ -942,7 +942,7 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
942
942
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native2.View, { style: { flex: 1 }, children: [
943
943
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(SearchField, { children: [
944
944
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SearchIconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SearchIcon, {}) }),
945
- isBottomSheet ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
945
+ isBottomSheet && (import_react_native2.Platform.OS === "ios" || import_react_native2.Platform.OS === "android") ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
946
946
  BottomSheetInput,
947
947
  {
948
948
  ref: inputRef,
@@ -1602,7 +1602,7 @@ var MobileMenuDrawer = (0, import_react17.memo)(
1602
1602
  const handleIndicatorStyle = (0, import_react17.useMemo)(() => {
1603
1603
  return { backgroundColor: theme.textMutedColor };
1604
1604
  }, [theme.textMutedColor]);
1605
- const contentContainerStyle2 = (0, import_react17.useMemo)(() => {
1605
+ const contentContainerStyle = (0, import_react17.useMemo)(() => {
1606
1606
  return { paddingBottom: insets.bottom };
1607
1607
  }, [insets.bottom]);
1608
1608
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -1627,7 +1627,7 @@ var MobileMenuDrawer = (0, import_react17.memo)(
1627
1627
  {
1628
1628
  ref: scrollRef,
1629
1629
  keyboardShouldPersistTaps: "handled",
1630
- contentContainerStyle: contentContainerStyle2,
1630
+ contentContainerStyle,
1631
1631
  children
1632
1632
  }
1633
1633
  )
@@ -1864,7 +1864,6 @@ var desktopLogoContainer = {
1864
1864
  paddingRight: 10,
1865
1865
  justifyContent: "space-between"
1866
1866
  };
1867
- var contentContainerStyle = { flex: 1, overflow: "hidden" };
1868
1867
  var mobileContentStyle = { flex: 1, overflow: "hidden" };
1869
1868
  var placeholderObject = {};
1870
1869
  var iconFloatRightStyle = { marginLeft: "auto" };
@@ -1876,15 +1875,31 @@ var mobileMenuDrawerContentStyle = {
1876
1875
  paddingBottom: 4
1877
1876
  };
1878
1877
  var flex1 = { flex: 1 };
1879
- var FullUI = ({ storage, theme, storyHash, story, children }) => {
1878
+ var FullUI = ({
1879
+ storage,
1880
+ theme,
1881
+ storyHash,
1882
+ story,
1883
+ storyBackgroundColor,
1884
+ children
1885
+ }) => {
1880
1886
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native_theming15.ThemeProvider, { theme, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native_safe_area_context3.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native_gesture_handler2.GestureHandlerRootView, { style: flex1, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_bottom_sheet4.BottomSheetModalProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native_ui_common7.StorageProvider, { storage, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native_ui_common7.LayoutProvider, { children: [
1881
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Layout, { storyHash, story, children }),
1887
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1888
+ Layout,
1889
+ {
1890
+ storyHash,
1891
+ story,
1892
+ storyBackgroundColor,
1893
+ children
1894
+ }
1895
+ ),
1882
1896
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_portal.PortalHost, { name: "storybook-lite-ui-root" })
1883
1897
  ] }) }) }) }) }) });
1884
1898
  };
1885
1899
  var Layout = ({
1886
1900
  storyHash,
1887
1901
  story,
1902
+ storyBackgroundColor,
1888
1903
  children
1889
1904
  }) => {
1890
1905
  const theme = (0, import_react_native_theming15.useTheme)();
@@ -1941,9 +1956,23 @@ var Layout = ({
1941
1956
  return {
1942
1957
  flex: 1,
1943
1958
  paddingTop: story?.parameters?.noSafeArea ? 0 : insets.top,
1944
- backgroundColor: theme.background.content
1959
+ backgroundColor: storyBackgroundColor || theme.background.content
1945
1960
  };
1946
- }, [theme.background.content, insets.top, story?.parameters?.noSafeArea, isDesktop]);
1961
+ }, [
1962
+ storyBackgroundColor,
1963
+ theme.background.content,
1964
+ insets.top,
1965
+ story?.parameters?.noSafeArea,
1966
+ isDesktop
1967
+ ]);
1968
+ const storyContentStyle = (0, import_react_native_ui_common7.useStyle)(
1969
+ () => ({
1970
+ flex: 1,
1971
+ overflow: "hidden",
1972
+ backgroundColor: storyBackgroundColor || theme.background.content
1973
+ }),
1974
+ [storyBackgroundColor, theme.background.content]
1975
+ );
1947
1976
  const fullScreenButtonStyle = (0, import_react_native_ui_common7.useStyle)(
1948
1977
  () => ({
1949
1978
  position: "absolute",
@@ -1959,7 +1988,7 @@ var Layout = ({
1959
1988
  );
1960
1989
  const menuContainerStyle = (0, import_react_native_ui_common7.useStyle)(
1961
1990
  () => ({
1962
- marginBottom: insets.bottom
1991
+ paddingBottom: insets.bottom
1963
1992
  }),
1964
1993
  [insets.bottom]
1965
1994
  );
@@ -2005,7 +2034,7 @@ var Layout = ({
2005
2034
  }
2006
2035
  ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native_ui_common7.IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon }) }) : null,
2007
2036
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native8.View, { style: mobileContentStyle, children: [
2008
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native8.View, { style: contentContainerStyle, children }),
2037
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native8.View, { style: storyContentStyle, children }),
2009
2038
  story?.parameters?.hideFullScreenButton || isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2010
2039
  import_react_native8.TouchableOpacity,
2011
2040
  {
@@ -2050,7 +2079,7 @@ var Layout = ({
2050
2079
  }
2051
2080
  )
2052
2081
  ] }) }) : null,
2053
- isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectedNodeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
2082
+ !isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectedNodeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
2054
2083
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native8.View, { style: mobileMenuDrawerContentStyle, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StorybookLogo, { theme }) }),
2055
2084
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2056
2085
  Sidebar,
@@ -2065,8 +2094,8 @@ var Layout = ({
2065
2094
  refId: DEFAULT_REF_ID
2066
2095
  }
2067
2096
  )
2068
- ] }) }),
2069
- isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
2097
+ ] }) }) : null,
2098
+ !isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id }) : null
2070
2099
  ] });
2071
2100
  };
2072
2101
  var Nav = import_react_native_theming15.styled.View({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui",
3
- "version": "10.2.3",
3
+ "version": "10.3.0-canary-20260217005118",
4
4
  "description": "ui components for react native storybook",
5
5
  "keywords": [
6
6
  "react",
@@ -36,8 +36,8 @@
36
36
  "@gorhom/portal": "^1.0.14",
37
37
  "@nozbe/microfuzz": "^1.0.0",
38
38
  "@storybook/react": "^10.2.3",
39
- "@storybook/react-native-theming": "^10.2.3",
40
- "@storybook/react-native-ui-common": "^10.2.3",
39
+ "@storybook/react-native-theming": "10.3.0-canary-20260217005118",
40
+ "@storybook/react-native-ui-common": "10.3.0-canary-20260217005118",
41
41
  "polished": "^4.3.1"
42
42
  },
43
43
  "peerDependencies": {
package/src/Layout.tsx CHANGED
@@ -60,7 +60,14 @@ const mobileMenuDrawerContentStyle = {
60
60
 
61
61
  const flex1 = { flex: 1 } satisfies ViewStyle;
62
62
 
63
- export const FullUI: SBUI = ({ storage, theme, storyHash, story, children }) => {
63
+ export const FullUI: SBUI = ({
64
+ storage,
65
+ theme,
66
+ storyHash,
67
+ story,
68
+ storyBackgroundColor,
69
+ children,
70
+ }) => {
64
71
  return (
65
72
  <ThemeProvider theme={theme}>
66
73
  <SafeAreaProvider>
@@ -68,7 +75,11 @@ export const FullUI: SBUI = ({ storage, theme, storyHash, story, children }) =>
68
75
  <BottomSheetModalProvider>
69
76
  <StorageProvider storage={storage}>
70
77
  <LayoutProvider>
71
- <Layout storyHash={storyHash} story={story}>
78
+ <Layout
79
+ storyHash={storyHash}
80
+ story={story}
81
+ storyBackgroundColor={storyBackgroundColor}
82
+ >
72
83
  {children}
73
84
  </Layout>
74
85
  <PortalHost name="storybook-lite-ui-root" />
@@ -84,10 +95,12 @@ export const FullUI: SBUI = ({ storage, theme, storyHash, story, children }) =>
84
95
  export const Layout = ({
85
96
  storyHash,
86
97
  story,
98
+ storyBackgroundColor,
87
99
  children,
88
100
  }: {
89
101
  storyHash: API_IndexHash | undefined;
90
102
  story?: StoryContext<ReactRenderer, Args>;
103
+ storyBackgroundColor?: string;
91
104
  children: ReactNode | ReactNode[];
92
105
  }) => {
93
106
  const theme = useTheme();
@@ -153,9 +166,24 @@ export const Layout = ({
153
166
  return {
154
167
  flex: 1,
155
168
  paddingTop: story?.parameters?.noSafeArea ? 0 : insets.top,
156
- backgroundColor: theme.background.content,
169
+ backgroundColor: storyBackgroundColor || theme.background.content,
157
170
  };
158
- }, [theme.background.content, insets.top, story?.parameters?.noSafeArea, isDesktop]);
171
+ }, [
172
+ storyBackgroundColor,
173
+ theme.background.content,
174
+ insets.top,
175
+ story?.parameters?.noSafeArea,
176
+ isDesktop,
177
+ ]);
178
+
179
+ const storyContentStyle = useStyle(
180
+ () => ({
181
+ flex: 1,
182
+ overflow: 'hidden' as const,
183
+ backgroundColor: storyBackgroundColor || theme.background.content,
184
+ }),
185
+ [storyBackgroundColor, theme.background.content]
186
+ );
159
187
 
160
188
  const fullScreenButtonStyle = useStyle(
161
189
  () => ({
@@ -173,7 +201,7 @@ export const Layout = ({
173
201
 
174
202
  const menuContainerStyle = useStyle(
175
203
  () => ({
176
- marginBottom: insets.bottom,
204
+ paddingBottom: insets.bottom,
177
205
  }),
178
206
  [insets.bottom]
179
207
  );
@@ -229,7 +257,7 @@ export const Layout = ({
229
257
  ) : null}
230
258
 
231
259
  <View style={mobileContentStyle}>
232
- <View style={contentContainerStyle}>{children}</View>
260
+ <View style={storyContentStyle}>{children}</View>
233
261
 
234
262
  {story?.parameters?.hideFullScreenButton || isDesktop ? null : (
235
263
  <TouchableOpacity
@@ -283,7 +311,7 @@ export const Layout = ({
283
311
  </Container>
284
312
  ) : null}
285
313
 
286
- {isDesktop ? null : (
314
+ {!isDesktop ? (
287
315
  <SelectedNodeProvider>
288
316
  <MobileMenuDrawer ref={mobileMenuDrawerRef}>
289
317
  <View style={mobileMenuDrawerContentStyle}>
@@ -302,9 +330,9 @@ export const Layout = ({
302
330
  />
303
331
  </MobileMenuDrawer>
304
332
  </SelectedNodeProvider>
305
- )}
333
+ ) : null}
306
334
 
307
- {isDesktop ? null : <MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />}
335
+ {!isDesktop ? <MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} /> : null}
308
336
  </View>
309
337
  );
310
338
  };
package/src/Search.tsx CHANGED
@@ -241,7 +241,7 @@ export const Search = React.memo<{
241
241
  <SearchIcon />
242
242
  </SearchIconWrapper>
243
243
 
244
- {isBottomSheet ? (
244
+ {isBottomSheet && (Platform.OS === 'ios' || Platform.OS === 'android') ? (
245
245
  <BottomSheetInput
246
246
  ref={inputRef as any} // TODO find solution for this
247
247
  onChangeText={setInputValue}