@storybook/react-native-ui-lite 11.0.0-next.2 → 11.0.0-next.4

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
@@ -376,11 +376,12 @@ const SelectedNodeProvider = ({ children }) => {
376
376
  const scrollCallback = (0, react.useCallback)((options) => {
377
377
  scrollCallbackValue?.(options);
378
378
  }, [scrollCallbackValue]);
379
+ const value = (0, react.useMemo)(() => ({
380
+ scrollCallback,
381
+ registerCallback
382
+ }), [scrollCallback, registerCallback]);
379
383
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectedNodeContext.Provider, {
380
- value: {
381
- scrollCallback,
382
- registerCallback
383
- },
384
+ value,
384
385
  children
385
386
  });
386
387
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui-lite",
3
- "version": "11.0.0-next.2",
3
+ "version": "11.0.0-next.4",
4
4
  "description": "lightweight ui components for react native storybook",
5
5
  "keywords": [
6
6
  "react",
@@ -31,14 +31,14 @@
31
31
  "@gorhom/portal": "^1.0.14",
32
32
  "@legendapp/list": "^3.7.2",
33
33
  "@nozbe/microfuzz": "^1.0.0",
34
- "@storybook/react": "^11.0.0-beta.3",
35
- "@storybook/react-native-theming": "^11.0.0-next.2",
36
- "@storybook/react-native-ui-common": "^11.0.0-next.2",
34
+ "@storybook/react": "^11.0.0-rc.1",
35
+ "@storybook/react-native-theming": "^11.0.0-next.4",
36
+ "@storybook/react-native-ui-common": "^11.0.0-next.4",
37
37
  "polished": "^4.3.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "~19.3.0",
41
- "storybook": "^11.0.0-beta.3",
41
+ "storybook": "^11.0.0-rc.1",
42
42
  "ts-dedent": "^2.3.0",
43
43
  "tsdown": "^0.23.7",
44
44
  "typescript": "~6.0.3"
@@ -1,5 +1,5 @@
1
1
  import type { FC, PropsWithChildren } from 'react';
2
- import { createContext, useCallback, useContext, useState } from 'react';
2
+ import { createContext, useCallback, useContext, useMemo, useState } from 'react';
3
3
  type CallbackOptions = { id?: string; animated?: boolean };
4
4
 
5
5
  type SelectedNodeContextType = {
@@ -28,16 +28,13 @@ export const SelectedNodeProvider: FC<PropsWithChildren> = ({ children }) => {
28
28
  [scrollCallbackValue]
29
29
  );
30
30
 
31
- return (
32
- <SelectedNodeContext.Provider
33
- value={{
34
- scrollCallback,
35
- registerCallback,
36
- }}
37
- >
38
- {children}
39
- </SelectedNodeContext.Provider>
31
+ // Keep the value stable between renders, so its consumers re-render only when it changes.
32
+ const value = useMemo(
33
+ () => ({ scrollCallback, registerCallback }),
34
+ [scrollCallback, registerCallback]
40
35
  );
36
+
37
+ return <SelectedNodeContext.Provider value={value}>{children}</SelectedNodeContext.Provider>;
41
38
  };
42
39
 
43
40
  export const useSelectedNode = () => useContext(SelectedNodeContext);