@storybook/react-native-ui-lite 10.7.1 → 10.7.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/index.js +5 -4
- package/package.json +5 -5
- package/src/SelectedNodeProvider.tsx +7 -10
package/dist/index.js
CHANGED
|
@@ -381,11 +381,12 @@ const SelectedNodeProvider = ({ children }) => {
|
|
|
381
381
|
const scrollCallback = (0, react.useCallback)((options) => {
|
|
382
382
|
scrollCallbackValue?.(options);
|
|
383
383
|
}, [scrollCallbackValue]);
|
|
384
|
+
const value = (0, react.useMemo)(() => ({
|
|
385
|
+
scrollCallback,
|
|
386
|
+
registerCallback
|
|
387
|
+
}), [scrollCallback, registerCallback]);
|
|
384
388
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectedNodeContext.Provider, {
|
|
385
|
-
value
|
|
386
|
-
scrollCallback,
|
|
387
|
-
registerCallback
|
|
388
|
-
},
|
|
389
|
+
value,
|
|
389
390
|
children
|
|
390
391
|
});
|
|
391
392
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-ui-lite",
|
|
3
|
-
"version": "10.7.
|
|
3
|
+
"version": "10.7.3",
|
|
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.3.3",
|
|
33
33
|
"@nozbe/microfuzz": "^1.0.0",
|
|
34
|
-
"@storybook/react": "^10.6.
|
|
35
|
-
"@storybook/react-native-theming": "^10.7.
|
|
36
|
-
"@storybook/react-native-ui-common": "^10.7.
|
|
34
|
+
"@storybook/react": "^10.6.7",
|
|
35
|
+
"@storybook/react-native-theming": "^10.7.3",
|
|
36
|
+
"@storybook/react-native-ui-common": "^10.7.3",
|
|
37
37
|
"polished": "^4.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "~19.2.14",
|
|
41
|
-
"storybook": "^10.6.
|
|
41
|
+
"storybook": "^10.6.7",
|
|
42
42
|
"ts-dedent": "^2.3.0",
|
|
43
43
|
"tsdown": "^0.22.12",
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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);
|