@storybook/react-native-ui 8.5.2-alpha.0 → 8.5.2-alpha.1

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.js CHANGED
@@ -4129,7 +4129,8 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
4129
4129
  },
4130
4130
  [allComponents, dataset.hash, getLastViewed, makeFuse]
4131
4131
  );
4132
- const input = inputValue ? inputValue.trim() : "";
4132
+ const deferredQuery = (0, import_react10.useDeferredValue)(inputValue);
4133
+ const input = deferredQuery ? deferredQuery.trim() : "";
4133
4134
  const results = input ? getResults(input) : [];
4134
4135
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native3.View, { style: { flex: 1 }, children: [
4135
4136
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SearchField, { children: [
@@ -4655,7 +4656,7 @@ var TabText = import_react_native_theming12.styled.Text(({ theme, active }) => (
4655
4656
  }));
4656
4657
 
4657
4658
  // src/MobileMenuDrawer.tsx
4658
- var import_bottom_sheet3 = require("@gorhom/bottom-sheet");
4659
+ var import_bottom_sheet3 = __toESM(require("@gorhom/bottom-sheet"));
4659
4660
  var import_react16 = require("react");
4660
4661
  var import_react_native7 = require("react-native");
4661
4662
  var import_react_native_reanimated2 = require("react-native-reanimated");
@@ -4681,27 +4682,25 @@ var MobileMenuDrawer = (0, import_react16.forwardRef)(
4681
4682
  (0, import_react16.useImperativeHandle)(ref, () => ({
4682
4683
  setMobileMenuOpen: (open) => {
4683
4684
  if (open) {
4684
- menuBottomSheetRef.current?.present();
4685
+ menuBottomSheetRef.current?.expand();
4685
4686
  } else {
4686
4687
  import_react_native7.Keyboard.dismiss();
4687
- menuBottomSheetRef.current?.dismiss();
4688
+ menuBottomSheetRef.current?.close();
4688
4689
  }
4689
4690
  }
4690
4691
  }));
4691
4692
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4692
- import_bottom_sheet3.BottomSheetModal,
4693
+ import_bottom_sheet3.default,
4693
4694
  {
4694
4695
  ref: menuBottomSheetRef,
4695
- index: 1,
4696
+ index: -1,
4696
4697
  animateOnMount: !reducedMotion,
4697
4698
  snapPoints: ["50%", "75%"],
4698
- enableDismissOnClose: true,
4699
4699
  enableHandlePanningGesture: true,
4700
4700
  enableContentPanningGesture: true,
4701
4701
  enableDynamicSizing: false,
4702
4702
  keyboardBehavior: "extend",
4703
4703
  keyboardBlurBehavior: "restore",
4704
- stackBehavior: "replace",
4705
4704
  backdropComponent: BottomSheetBackdropComponent,
4706
4705
  backgroundStyle: { backgroundColor: theme.background.content },
4707
4706
  handleIndicatorStyle: { backgroundColor: theme.textMutedColor },
@@ -5201,27 +5200,6 @@ var Layout = ({
5201
5200
  }
5202
5201
  )
5203
5202
  ] }),
5204
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
5205
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: { paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }) }),
5206
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5207
- Sidebar,
5208
- {
5209
- extra: [],
5210
- previewInitialized: true,
5211
- indexError: void 0,
5212
- refs: {},
5213
- setSelection: ({ storyId: newStoryId }) => {
5214
- const channel = import_manager_api2.addons.getChannel();
5215
- channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
5216
- },
5217
- status: {},
5218
- index: storyHash,
5219
- storyId: story?.id,
5220
- refId: DEFAULT_REF_ID
5221
- }
5222
- )
5223
- ] }),
5224
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id }),
5225
5203
  !uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Container3, { style: { marginBottom: insets.bottom }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Nav, { children: [
5226
5204
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5227
5205
  Button2,
@@ -5250,7 +5228,28 @@ var Layout = ({
5250
5228
  Icon: BottomBarToggleIcon
5251
5229
  }
5252
5230
  )
5253
- ] }) }) : null
5231
+ ] }) }) : null,
5232
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
5233
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: { paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }) }),
5234
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5235
+ Sidebar,
5236
+ {
5237
+ extra: [],
5238
+ previewInitialized: true,
5239
+ indexError: void 0,
5240
+ refs: {},
5241
+ setSelection: ({ storyId: newStoryId }) => {
5242
+ const channel = import_manager_api2.addons.getChannel();
5243
+ channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
5244
+ },
5245
+ status: {},
5246
+ index: storyHash,
5247
+ storyId: story?.id,
5248
+ refId: DEFAULT_REF_ID
5249
+ }
5250
+ )
5251
+ ] }),
5252
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
5254
5253
  ]
5255
5254
  }
5256
5255
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui",
3
- "version": "8.5.2-alpha.0",
3
+ "version": "8.5.2-alpha.1",
4
4
  "description": "ui components for react native storybook",
5
5
  "keywords": [
6
6
  "react",
@@ -60,7 +60,7 @@
60
60
  "dependencies": {
61
61
  "@storybook/core": "^8.4.2",
62
62
  "@storybook/react": "^8.4.2",
63
- "@storybook/react-native-theming": "^8.5.2-alpha.0",
63
+ "@storybook/react-native-theming": "^8.5.2-alpha.1",
64
64
  "fuse.js": "^7.0.0",
65
65
  "memoizerific": "^1.11.3",
66
66
  "polished": "^4.3.1",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "9404dd2484bf4c4851724639a36c93926e03311f"
84
+ "gitHead": "6829dc629b4ca18e2869267a9c9e0afed094f2f3"
85
85
  }
package/src/Layout.tsx CHANGED
@@ -169,30 +169,6 @@ export const Layout = ({
169
169
  )}
170
170
  </View>
171
171
 
172
- <MobileMenuDrawer ref={mobileMenuDrawerRef}>
173
- <View style={{ paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }}>
174
- <StorybookLogo theme={theme} />
175
- </View>
176
-
177
- <Sidebar
178
- extra={[]}
179
- previewInitialized
180
- indexError={undefined}
181
- refs={{}}
182
- setSelection={({ storyId: newStoryId }) => {
183
- const channel = addons.getChannel();
184
-
185
- channel.emit(SET_CURRENT_STORY, { storyId: newStoryId });
186
- }}
187
- status={{}}
188
- index={storyHash}
189
- storyId={story?.id}
190
- refId={DEFAULT_REF_ID}
191
- />
192
- </MobileMenuDrawer>
193
-
194
- <MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />
195
-
196
172
  {!uiHidden ? (
197
173
  <Container style={{ marginBottom: insets.bottom }}>
198
174
  <Nav>
@@ -218,6 +194,30 @@ export const Layout = ({
218
194
  </Nav>
219
195
  </Container>
220
196
  ) : null}
197
+
198
+ <MobileMenuDrawer ref={mobileMenuDrawerRef}>
199
+ <View style={{ paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }}>
200
+ <StorybookLogo theme={theme} />
201
+ </View>
202
+
203
+ <Sidebar
204
+ extra={[]}
205
+ previewInitialized
206
+ indexError={undefined}
207
+ refs={{}}
208
+ setSelection={({ storyId: newStoryId }) => {
209
+ const channel = addons.getChannel();
210
+
211
+ channel.emit(SET_CURRENT_STORY, { storyId: newStoryId });
212
+ }}
213
+ status={{}}
214
+ index={storyHash}
215
+ storyId={story?.id}
216
+ refId={DEFAULT_REF_ID}
217
+ />
218
+ </MobileMenuDrawer>
219
+
220
+ <MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />
221
221
  </View>
222
222
  );
223
223
  };
@@ -1,4 +1,4 @@
1
- import {
1
+ import BottomSheet, {
2
2
  BottomSheetBackdrop,
3
3
  BottomSheetBackdropProps,
4
4
  BottomSheetModal,
@@ -39,28 +39,30 @@ export const MobileMenuDrawer = forwardRef<MobileMenuDrawerRef, MobileMenuDrawer
39
39
  useImperativeHandle(ref, () => ({
40
40
  setMobileMenuOpen: (open: boolean) => {
41
41
  if (open) {
42
- menuBottomSheetRef.current?.present();
42
+ // menuBottomSheetRef.current?.present();
43
+ menuBottomSheetRef.current?.expand();
43
44
  } else {
44
45
  Keyboard.dismiss();
45
46
 
46
- menuBottomSheetRef.current?.dismiss();
47
+ // menuBottomSheetRef.current?.dismiss();
48
+ menuBottomSheetRef.current?.close();
47
49
  }
48
50
  },
49
51
  }));
50
52
 
51
53
  return (
52
- <BottomSheetModal
54
+ <BottomSheet
53
55
  ref={menuBottomSheetRef}
54
- index={1}
56
+ index={-1}
55
57
  animateOnMount={!reducedMotion}
56
58
  snapPoints={['50%', '75%']}
57
- enableDismissOnClose
59
+ // enableDismissOnClose
58
60
  enableHandlePanningGesture
59
61
  enableContentPanningGesture
60
62
  enableDynamicSizing={false}
61
63
  keyboardBehavior="extend"
62
64
  keyboardBlurBehavior="restore"
63
- stackBehavior="replace"
65
+ // stackBehavior="replace"
64
66
  backdropComponent={BottomSheetBackdropComponent}
65
67
  backgroundStyle={{ backgroundColor: theme.background.content }}
66
68
  handleIndicatorStyle={{ backgroundColor: theme.textMutedColor }}
@@ -73,7 +75,7 @@ export const MobileMenuDrawer = forwardRef<MobileMenuDrawerRef, MobileMenuDrawer
73
75
  >
74
76
  {children}
75
77
  </BottomSheetScrollView>
76
- </BottomSheetModal>
78
+ </BottomSheet>
77
79
  );
78
80
  }
79
81
  );
package/src/Search.tsx CHANGED
@@ -2,7 +2,7 @@ import { BottomSheetTextInput } from '@gorhom/bottom-sheet';
2
2
  import { styled } from '@storybook/react-native-theming';
3
3
  import type { IFuseOptions } from 'fuse.js';
4
4
  import Fuse from 'fuse.js';
5
- import React, { useCallback, useRef, useState } from 'react';
5
+ import React, { useCallback, useDeferredValue, useRef, useState } from 'react';
6
6
  import { TextInput, View } from 'react-native';
7
7
  import { CloseIcon } from './icon/CloseIcon';
8
8
  import { SearchIcon } from './icon/SearchIcon';
@@ -219,8 +219,8 @@ export const Search = React.memo<{
219
219
  },
220
220
  [allComponents, dataset.hash, getLastViewed, makeFuse]
221
221
  );
222
-
223
- const input = inputValue ? inputValue.trim() : '';
222
+ const deferredQuery = useDeferredValue(inputValue);
223
+ const input = deferredQuery ? deferredQuery.trim() : '';
224
224
  const results = input ? getResults(input) : [];
225
225
 
226
226
  return (