@applicaster/zapp-react-native-ui-components 14.0.15 → 14.0.16-alpha.1894651754
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.
|
@@ -81,11 +81,29 @@ const createStore = () =>
|
|
|
81
81
|
},
|
|
82
82
|
}));
|
|
83
83
|
|
|
84
|
+
const createScreenComponentsStore = () =>
|
|
85
|
+
create(subscribeWithSelector<Record<string, unknown>>((_) => ({})));
|
|
86
|
+
|
|
84
87
|
type ScreenContextType = {
|
|
85
88
|
_navBarStore: ReturnType<typeof createStore>;
|
|
86
89
|
_stateStore: ReturnType<typeof createStateStore>;
|
|
87
90
|
navBar: NavBarState;
|
|
88
91
|
legacyFormatScreenData: LegacyNavigationScreenData | null;
|
|
92
|
+
/**
|
|
93
|
+
* Zustand store for component-level state within a screen.
|
|
94
|
+
*
|
|
95
|
+
* **Purpose:** Persists state across component mount/unmount cycles (e.g., during virtualization)
|
|
96
|
+
* and enables state sharing between components using the same key within the same screen.
|
|
97
|
+
*
|
|
98
|
+
* **Lifecycle:** Tied to the screen/route — recreated on each route change.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // Used by useComponentScreenState hook:
|
|
102
|
+
* const store = useScreenContextV2()._componentStateStore;
|
|
103
|
+
* store.setState({ 'my-key': value });
|
|
104
|
+
* const value = store.getState()['my-key'];
|
|
105
|
+
*/
|
|
106
|
+
_componentStateStore: ReturnType<typeof createScreenComponentsStore>;
|
|
89
107
|
};
|
|
90
108
|
|
|
91
109
|
export const ScreenContext = createContext<ScreenContextType>({
|
|
@@ -100,6 +118,7 @@ export const ScreenContext = createContext<ScreenContextType>({
|
|
|
100
118
|
setSummary: (_subtitle) => void 0,
|
|
101
119
|
},
|
|
102
120
|
legacyFormatScreenData: {} as LegacyNavigationScreenData,
|
|
121
|
+
_componentStateStore: createScreenComponentsStore(),
|
|
103
122
|
});
|
|
104
123
|
|
|
105
124
|
export function ScreenContextProvider({
|
|
@@ -153,6 +172,14 @@ export function ScreenContextProvider({
|
|
|
153
172
|
return navBarState;
|
|
154
173
|
}, []);
|
|
155
174
|
|
|
175
|
+
// Component state store - recreated when pathname changes (route change).
|
|
176
|
+
// Unlike _navBarStore and _stateStore (cached via refs), this store
|
|
177
|
+
// resets only when pathname changes to provide a clean state for the new route.
|
|
178
|
+
const componentStateStore = useMemo(
|
|
179
|
+
() => createScreenComponentsStore(),
|
|
180
|
+
[pathname]
|
|
181
|
+
);
|
|
182
|
+
|
|
156
183
|
const screenNavBarState = getScreenNavBarState()(
|
|
157
184
|
useShallow((state) => ({
|
|
158
185
|
visible: state.visible,
|
|
@@ -205,8 +232,9 @@ export function ScreenContextProvider({
|
|
|
205
232
|
_stateStore: getScreenState(),
|
|
206
233
|
navBar: navBarState,
|
|
207
234
|
legacyFormatScreenData: routeScreenData,
|
|
235
|
+
_componentStateStore: componentStateStore,
|
|
208
236
|
}),
|
|
209
|
-
[navBarState, screenData, routeScreenData]
|
|
237
|
+
[navBarState, screenData, routeScreenData, componentStateStore]
|
|
210
238
|
)}
|
|
211
239
|
>
|
|
212
240
|
{children}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.16-alpha.1894651754",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "14.0.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "14.0.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "14.0.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "14.0.
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.16-alpha.1894651754",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "14.0.16-alpha.1894651754",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "14.0.16-alpha.1894651754",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "14.0.16-alpha.1894651754",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|