@applicaster/zapp-react-native-ui-components 15.0.0-rc.103 → 15.0.0-rc.105

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.
@@ -88,11 +88,29 @@ const createStore = () =>
88
88
  }))
89
89
  );
90
90
 
91
+ const createScreenComponentsStore = () =>
92
+ create(subscribeWithSelector<Record<string, unknown>>((_) => ({})));
93
+
91
94
  type ScreenContextType = {
92
95
  _navBarStore: ReturnType<typeof createStore>;
93
96
  _stateStore: ReturnType<typeof createStateStore>;
94
97
  navBar: NavBarState;
95
98
  legacyFormatScreenData: LegacyNavigationScreenData | null;
99
+ /**
100
+ * Zustand store for component-level state within a screen.
101
+ *
102
+ * **Purpose:** Persists state across component mount/unmount cycles (e.g., during virtualization)
103
+ * and enables state sharing between components using the same key within the same screen.
104
+ *
105
+ * **Lifecycle:** Tied to the screen/route — recreated on each route change.
106
+ *
107
+ * @example
108
+ * // Used by useComponentScreenState hook:
109
+ * const store = useScreenContextV2()._componentStateStore;
110
+ * store.setState({ 'my-key': value });
111
+ * const value = store.getState()['my-key'];
112
+ */
113
+ _componentStateStore: ReturnType<typeof createScreenComponentsStore>;
96
114
  };
97
115
 
98
116
  export const ScreenContext = createContext<ScreenContextType>({
@@ -107,6 +125,7 @@ export const ScreenContext = createContext<ScreenContextType>({
107
125
  setSummary: (_subtitle) => void 0,
108
126
  },
109
127
  legacyFormatScreenData: {} as LegacyNavigationScreenData,
128
+ _componentStateStore: createScreenComponentsStore(),
110
129
  });
111
130
 
112
131
  export function ScreenContextProvider({
@@ -160,6 +179,14 @@ export function ScreenContextProvider({
160
179
  return navBarState;
161
180
  }, []);
162
181
 
182
+ // Component state store - recreated when pathname changes (route change).
183
+ // Unlike _navBarStore and _stateStore (cached via refs), this store
184
+ // resets only when pathname changes to provide a clean state for the new route.
185
+ const componentStateStore = useMemo(
186
+ () => createScreenComponentsStore(),
187
+ [pathname]
188
+ );
189
+
163
190
  const screenNavBarState = getScreenNavBarState()(
164
191
  useShallow((state) => ({
165
192
  visible: state.visible,
@@ -212,8 +239,9 @@ export function ScreenContextProvider({
212
239
  _stateStore: getScreenState(),
213
240
  navBar: navBarState,
214
241
  legacyFormatScreenData: routeScreenData,
242
+ _componentStateStore: componentStateStore,
215
243
  }),
216
- [navBarState, screenData, routeScreenData]
244
+ [navBarState, screenData, routeScreenData, componentStateStore]
217
245
  )}
218
246
  >
219
247
  {children}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "15.0.0-rc.103",
3
+ "version": "15.0.0-rc.105",
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": "15.0.0-rc.103",
32
- "@applicaster/zapp-react-native-bridge": "15.0.0-rc.103",
33
- "@applicaster/zapp-react-native-redux": "15.0.0-rc.103",
34
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.103",
31
+ "@applicaster/applicaster-types": "15.0.0-rc.105",
32
+ "@applicaster/zapp-react-native-bridge": "15.0.0-rc.105",
33
+ "@applicaster/zapp-react-native-redux": "15.0.0-rc.105",
34
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.105",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",