react-native-divkit 0.1.0-alpha.1 → 0.1.0-alpha.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.
Files changed (150) hide show
  1. package/README.md +200 -201
  2. package/dist/DivKit.d.ts.map +1 -1
  3. package/dist/DivKit.js +24 -7
  4. package/dist/DivKit.js.map +1 -1
  5. package/dist/actions/array.d.ts.map +1 -1
  6. package/dist/actions/array.js +1 -1
  7. package/dist/actions/array.js.map +1 -1
  8. package/dist/actions/copyToClipboard.d.ts.map +1 -1
  9. package/dist/actions/copyToClipboard.js +2 -1
  10. package/dist/actions/copyToClipboard.js.map +1 -1
  11. package/dist/actions/dict.d.ts.map +1 -1
  12. package/dist/actions/dict.js.map +1 -1
  13. package/dist/actions/updateStructure.d.ts.map +1 -1
  14. package/dist/actions/updateStructure.js.map +1 -1
  15. package/dist/components/container/DivContainer.d.ts.map +1 -1
  16. package/dist/components/container/DivContainer.js +3 -5
  17. package/dist/components/container/DivContainer.js.map +1 -1
  18. package/dist/components/image/DivImage.d.ts.map +1 -1
  19. package/dist/components/image/DivImage.js +1 -6
  20. package/dist/components/image/DivImage.js.map +1 -1
  21. package/dist/components/state/DivState.d.ts.map +1 -1
  22. package/dist/components/state/DivState.js +3 -5
  23. package/dist/components/state/DivState.js.map +1 -1
  24. package/dist/components/text/DivText.d.ts.map +1 -1
  25. package/dist/components/text/DivText.js +4 -4
  26. package/dist/components/text/DivText.js.map +1 -1
  27. package/dist/components/utilities/Background.d.ts +11 -0
  28. package/dist/components/utilities/Background.d.ts.map +1 -0
  29. package/dist/components/utilities/Background.js +73 -0
  30. package/dist/components/utilities/Background.js.map +1 -0
  31. package/dist/components/utilities/Outer.d.ts.map +1 -1
  32. package/dist/components/utilities/Outer.js +24 -10
  33. package/dist/components/utilities/Outer.js.map +1 -1
  34. package/dist/context/index.d.ts.map +1 -1
  35. package/dist/context/index.js.map +1 -1
  36. package/dist/expressions/eval.d.ts.map +1 -1
  37. package/dist/expressions/eval.js +19 -11
  38. package/dist/expressions/eval.js.map +1 -1
  39. package/dist/expressions/funcs/array.d.ts.map +1 -1
  40. package/dist/expressions/funcs/array.js +72 -168
  41. package/dist/expressions/funcs/array.js.map +1 -1
  42. package/dist/expressions/funcs/colors.d.ts.map +1 -1
  43. package/dist/expressions/funcs/colors.js.map +1 -1
  44. package/dist/expressions/funcs/customFuncs.d.ts.map +1 -1
  45. package/dist/expressions/funcs/customFuncs.js +6 -4
  46. package/dist/expressions/funcs/customFuncs.js.map +1 -1
  47. package/dist/expressions/funcs/datetime.d.ts.map +1 -1
  48. package/dist/expressions/funcs/datetime.js +1 -1
  49. package/dist/expressions/funcs/datetime.js.map +1 -1
  50. package/dist/expressions/funcs/dict.d.ts.map +1 -1
  51. package/dist/expressions/funcs/dict.js.map +1 -1
  52. package/dist/expressions/funcs/funcs.d.ts.map +1 -1
  53. package/dist/expressions/funcs/funcs.js +21 -13
  54. package/dist/expressions/funcs/funcs.js.map +1 -1
  55. package/dist/expressions/funcs/math.d.ts.map +1 -1
  56. package/dist/expressions/funcs/math.js +40 -20
  57. package/dist/expressions/funcs/math.js.map +1 -1
  58. package/dist/expressions/funcs/std.d.ts.map +1 -1
  59. package/dist/expressions/funcs/std.js +4 -4
  60. package/dist/expressions/funcs/std.js.map +1 -1
  61. package/dist/expressions/funcs/strings.d.ts.map +1 -1
  62. package/dist/expressions/funcs/strings.js +1 -2
  63. package/dist/expressions/funcs/strings.js.map +1 -1
  64. package/dist/expressions/funcs/trigonometry.js +2 -2
  65. package/dist/expressions/funcs/trigonometry.js.map +1 -1
  66. package/dist/expressions/json.d.ts +2 -2
  67. package/dist/expressions/json.d.ts.map +1 -1
  68. package/dist/expressions/json.js +6 -4
  69. package/dist/expressions/json.js.map +1 -1
  70. package/dist/expressions/utils.d.ts.map +1 -1
  71. package/dist/expressions/utils.js +9 -10
  72. package/dist/expressions/utils.js.map +1 -1
  73. package/dist/expressions/variable.d.ts.map +1 -1
  74. package/dist/expressions/variable.js +3 -7
  75. package/dist/expressions/variable.js.map +1 -1
  76. package/dist/expressions/walk.d.ts.map +1 -1
  77. package/dist/expressions/walk.js.map +1 -1
  78. package/dist/hooks/index.d.ts.map +1 -1
  79. package/dist/hooks/index.js.map +1 -1
  80. package/dist/hooks/useAction.d.ts.map +1 -1
  81. package/dist/hooks/useAction.js.map +1 -1
  82. package/dist/hooks/useDerivedFromVars.d.ts.map +1 -1
  83. package/dist/hooks/useDerivedFromVars.js.map +1 -1
  84. package/dist/hooks/useVariable.d.ts.map +1 -1
  85. package/dist/hooks/useVariable.js +4 -4
  86. package/dist/hooks/useVariable.js.map +1 -1
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/stores/createObservable.d.ts.map +1 -1
  90. package/dist/stores/createObservable.js.map +1 -1
  91. package/dist/utils/applyTemplate.d.ts +2 -2
  92. package/dist/utils/applyTemplate.d.ts.map +1 -1
  93. package/dist/utils/applyTemplate.js +13 -13
  94. package/dist/utils/applyTemplate.js.map +1 -1
  95. package/dist/utils/correctColor.d.ts.map +1 -1
  96. package/dist/utils/correctColor.js +8 -6
  97. package/dist/utils/correctColor.js.map +1 -1
  98. package/dist/utils/formatDate.d.ts.map +1 -1
  99. package/dist/utils/formatDate.js +7 -10
  100. package/dist/utils/formatDate.js.map +1 -1
  101. package/dist/utils/wrapError.d.ts.map +1 -1
  102. package/dist/utils/wrapError.js.map +1 -1
  103. package/package.json +8 -7
  104. package/src/DivKit.tsx +258 -220
  105. package/src/actions/array.ts +91 -64
  106. package/src/actions/copyToClipboard.ts +28 -19
  107. package/src/actions/dict.ts +36 -26
  108. package/src/actions/updateStructure.ts +86 -61
  109. package/src/components/README.md +38 -18
  110. package/src/components/container/DivContainer.tsx +4 -14
  111. package/src/components/image/DivImage.tsx +1 -11
  112. package/src/components/state/DivState.tsx +3 -9
  113. package/src/components/text/DivText.tsx +8 -20
  114. package/src/components/utilities/Background.tsx +120 -0
  115. package/src/components/utilities/Outer.tsx +24 -23
  116. package/src/components/utilities/README.md +37 -32
  117. package/src/context/index.ts +2 -11
  118. package/src/expressions/ast.d.ts +16 -9
  119. package/src/expressions/eval.ts +82 -37
  120. package/src/expressions/funcs/array.ts +129 -209
  121. package/src/expressions/funcs/colors.ts +1 -3
  122. package/src/expressions/funcs/customFuncs.ts +6 -4
  123. package/src/expressions/funcs/datetime.ts +10 -3
  124. package/src/expressions/funcs/dict.ts +16 -2
  125. package/src/expressions/funcs/funcs.ts +75 -89
  126. package/src/expressions/funcs/math.ts +103 -43
  127. package/src/expressions/funcs/std.ts +4 -7
  128. package/src/expressions/funcs/strings.ts +9 -25
  129. package/src/expressions/funcs/trigonometry.ts +2 -2
  130. package/src/expressions/json.ts +60 -53
  131. package/src/expressions/utils.ts +24 -22
  132. package/src/expressions/variable.ts +5 -21
  133. package/src/expressions/walk.ts +6 -3
  134. package/src/hooks/README.md +61 -53
  135. package/src/hooks/index.ts +3 -18
  136. package/src/hooks/useAction.ts +1 -3
  137. package/src/hooks/useDerivedFromVars.ts +3 -13
  138. package/src/hooks/useVariable.ts +7 -17
  139. package/src/index.ts +10 -48
  140. package/src/stores/createObservable.ts +35 -35
  141. package/src/types/alignment.d.ts +15 -6
  142. package/src/types/background.d.ts +6 -2
  143. package/src/types/base.d.ts +41 -9
  144. package/src/types/componentContext.d.ts +27 -22
  145. package/src/types/container.d.ts +1 -4
  146. package/src/types/text.d.ts +1 -1
  147. package/src/utils/applyTemplate.ts +103 -109
  148. package/src/utils/correctColor.ts +9 -8
  149. package/src/utils/formatDate.ts +175 -86
  150. package/src/utils/wrapError.ts +7 -4
package/src/DivKit.tsx CHANGED
@@ -36,14 +36,12 @@ import { dictSetValue } from './actions/dict';
36
36
  import { copyToClipboard } from './actions/copyToClipboard';
37
37
  import { updateStructure } from './actions/updateStructure';
38
38
  import { evalExpression } from './expressions/eval';
39
+ import { parse } from './expressions/expressions';
39
40
 
40
41
  /**
41
42
  * Callback for logging statistics
42
43
  */
43
- export type StatCallback = (stat: {
44
- type: string;
45
- action: Action;
46
- }) => void;
44
+ export type StatCallback = (stat: { type: string; action: Action }) => void;
47
45
 
48
46
  /**
49
47
  * Callback for custom actions (actions with URLs)
@@ -104,13 +102,16 @@ export function DivKit({
104
102
  const statesMap = useRef<Map<string, StateSetter>>(new Map());
105
103
 
106
104
  // Error logging
107
- const logError = useCallback((error: WrappedError) => {
108
- if (onError) {
109
- onError(error);
110
- } else {
111
- console.error('[DivKit Error]', error);
112
- }
113
- }, [onError]);
105
+ const logError = useCallback(
106
+ (error: WrappedError) => {
107
+ if (onError) {
108
+ onError(error);
109
+ } else {
110
+ console.error('[DivKit Error]', error);
111
+ }
112
+ },
113
+ [onError]
114
+ );
114
115
 
115
116
  // Parse JSON and apply templates
116
117
  const { rootDiv, initialVariables } = useMemo(() => {
@@ -132,15 +133,13 @@ export function DivKit({
132
133
  if (divData && typeof divData === 'object' && 'type' in divData) {
133
134
  try {
134
135
  // Use recursive template application to handle nested templates
135
- resolvedDiv = applyTemplatesRecursively(
136
- divData,
137
- templatesData,
138
- logError
139
- );
136
+ resolvedDiv = applyTemplatesRecursively(divData, templatesData, logError);
140
137
  } catch (err) {
141
- logError(wrapError(err as Error, {
142
- additional: { phase: 'template_resolution' }
143
- }));
138
+ logError(
139
+ wrapError(err as Error, {
140
+ additional: { phase: 'template_resolution' }
141
+ })
142
+ );
144
143
  }
145
144
  }
146
145
 
@@ -161,19 +160,17 @@ export function DivKit({
161
160
  return;
162
161
  }
163
162
 
164
- const variable = createVariable(
165
- varData.name,
166
- varData.type as VariableType,
167
- varData.value
168
- );
163
+ const variable = createVariable(varData.name, varData.type as VariableType, varData.value);
169
164
  map.set(varData.name, variable);
170
165
  } catch (err) {
171
- logError(wrapError(err as Error, {
172
- additional: {
173
- variable: varData.name,
174
- type: varData.type
175
- }
176
- }));
166
+ logError(
167
+ wrapError(err as Error, {
168
+ additional: {
169
+ variable: varData.name,
170
+ type: varData.type
171
+ }
172
+ })
173
+ );
177
174
  }
178
175
  });
179
176
 
@@ -186,133 +183,174 @@ export function DivKit({
186
183
  }, []);
187
184
 
188
185
  // Variable management
189
- const getVariable = useCallback((name: string): Variable | undefined => {
190
- return variables.get(name);
191
- }, [variables]);
192
-
193
- const setVariable = useCallback((name: string, value: unknown): void => {
194
- const variable = variables.get(name);
195
- if (!variable) {
196
- logError(wrapError(new Error('Variable not found'), {
197
- additional: { variable: name }
198
- }));
199
- return;
200
- }
186
+ const getVariable = useCallback(
187
+ (name: string): Variable | undefined => {
188
+ return variables.get(name);
189
+ },
190
+ [variables]
191
+ );
201
192
 
202
- try {
203
- variable.setValue(value);
204
- } catch (err) {
205
- logError(wrapError(err as Error, {
206
- additional: {
207
- variable: name,
208
- value
209
- }
210
- }));
211
- }
212
- }, [variables, logError]);
193
+ const setVariable = useCallback(
194
+ (name: string, value: unknown): void => {
195
+ const variable = variables.get(name);
196
+ if (!variable) {
197
+ logError(
198
+ wrapError(new Error('Variable not found'), {
199
+ additional: { variable: name }
200
+ })
201
+ );
202
+ return;
203
+ }
204
+
205
+ try {
206
+ variable.setValue(value);
207
+ } catch (err) {
208
+ logError(
209
+ wrapError(err as Error, {
210
+ additional: {
211
+ variable: name,
212
+ value
213
+ }
214
+ })
215
+ );
216
+ }
217
+ },
218
+ [variables, logError]
219
+ );
213
220
 
214
221
  // Action execution
215
- const execAnyActions = useCallback(async (
216
- actions: MaybeMissing<Action[]> | undefined,
217
- opts?: {
218
- componentContext?: ComponentContext;
219
- processUrls?: boolean;
220
- }
221
- ): Promise<void> => {
222
- if (!actions || !Array.isArray(actions)) {
223
- return;
224
- }
222
+ const execAnyActions = useCallback(
223
+ async (
224
+ actions: MaybeMissing<Action[]> | undefined,
225
+ opts?: {
226
+ componentContext?: ComponentContext;
227
+ processUrls?: boolean;
228
+ }
229
+ ): Promise<void> => {
230
+ if (!actions || !Array.isArray(actions)) {
231
+ return;
232
+ }
225
233
 
226
- const processUrls = opts?.processUrls ?? true;
227
- const componentContext = opts?.componentContext;
234
+ const processUrls = opts?.processUrls ?? true;
235
+ const componentContext = opts?.componentContext;
228
236
 
229
- for (const action of actions) {
230
- if (!action) continue;
237
+ for (const action of actions) {
238
+ if (!action) continue;
231
239
 
232
- // Log statistics
233
- if (action.log_id && onStat) {
234
- onStat({
235
- type: 'action',
236
- action: action as Action
237
- });
238
- }
240
+ // Log statistics
241
+ if (action.log_id && onStat) {
242
+ onStat({
243
+ type: 'action',
244
+ action: action as Action
245
+ });
246
+ }
239
247
 
240
- // Handle typed actions
241
- if (action.typed) {
242
- const typed = action.typed;
243
-
244
- try {
245
- switch (typed.type) {
246
- case 'set_variable':
247
- if (typed.variable_name && typed.value) {
248
- const typedValue = typed.value;
249
- let value: unknown;
250
-
251
- // Convert typed value to raw value
252
- if (typeof typedValue === 'object' && typedValue !== null && 'value' in typedValue) {
253
- value = typedValue.value;
254
- } else {
255
- value = typedValue;
248
+ // Handle typed actions
249
+ if (action.typed) {
250
+ const typed = action.typed;
251
+
252
+ try {
253
+ switch (typed.type) {
254
+ case 'set_variable':
255
+ if (typed.variable_name && typed.value) {
256
+ const typedValue = typed.value;
257
+ let value: unknown;
258
+
259
+ // Convert typed value to raw value
260
+ if (
261
+ typeof typedValue === 'object' &&
262
+ typedValue !== null &&
263
+ 'value' in typedValue
264
+ ) {
265
+ value = typedValue.value;
266
+ } else {
267
+ value = typedValue;
268
+ }
269
+
270
+ // Evaluate expression if value is a string with @{...}
271
+ if (typeof value === 'string' && value.includes('@{')) {
272
+ try {
273
+ const ast = parse(value, { startRule: 'JsonStringContents' });
274
+
275
+ const res = evalExpression(variables, undefined, undefined, ast);
276
+
277
+ if (res.result.type !== 'error') {
278
+ value = res.result.value;
279
+ }
280
+ } catch (err) {
281
+ logError(
282
+ wrapError(err as Error, {
283
+ additional: {
284
+ phase: 'set_variable_expression',
285
+ expression: value
286
+ }
287
+ })
288
+ );
289
+ }
290
+ }
291
+
292
+ setVariable(typed.variable_name, value);
256
293
  }
257
-
258
- setVariable(typed.variable_name, value);
259
- }
260
- break;
261
-
262
- case 'set_state': {
263
- const setStateAction = typed as any;
264
- if (setStateAction.state_id && setStateAction.temporary_state_id) {
265
- const setter = statesMap.current.get(setStateAction.state_id);
266
- if (setter) {
267
- await setter(String(setStateAction.temporary_state_id));
294
+ break;
295
+
296
+ case 'set_state': {
297
+ const setStateAction = typed as any;
298
+ if (setStateAction.state_id && setStateAction.temporary_state_id) {
299
+ const setter = statesMap.current.get(setStateAction.state_id);
300
+ if (setter) {
301
+ await setter(String(setStateAction.temporary_state_id));
302
+ }
268
303
  }
304
+ break;
269
305
  }
270
- break;
271
- }
272
306
 
273
- case 'array_insert_value':
274
- arrayInsert(componentContext, variables, logError, typed as any);
275
- break;
307
+ case 'array_insert_value':
308
+ arrayInsert(componentContext, variables, logError, typed as any);
309
+ break;
276
310
 
277
- case 'array_remove_value':
278
- arrayRemove(componentContext, variables, logError, typed as any);
279
- break;
311
+ case 'array_remove_value':
312
+ arrayRemove(componentContext, variables, logError, typed as any);
313
+ break;
280
314
 
281
- case 'array_set_value':
282
- arraySet(componentContext, variables, logError, typed as any);
283
- break;
315
+ case 'array_set_value':
316
+ arraySet(componentContext, variables, logError, typed as any);
317
+ break;
284
318
 
285
- case 'dict_set_value':
286
- dictSetValue(componentContext, variables, logError, typed as any);
287
- break;
319
+ case 'dict_set_value':
320
+ dictSetValue(componentContext, variables, logError, typed as any);
321
+ break;
288
322
 
289
- case 'update_structure':
290
- updateStructure(componentContext, variables, logError, typed as any);
291
- break;
323
+ case 'update_structure':
324
+ updateStructure(componentContext, variables, logError, typed as any);
325
+ break;
292
326
 
293
- case 'copy_to_clipboard':
294
- copyToClipboard(logError, typed as any);
295
- break;
327
+ case 'copy_to_clipboard':
328
+ copyToClipboard(logError, typed as any);
329
+ break;
296
330
 
297
- // MVP: Other action types deferred (timer, animator, etc.)
298
- default:
299
- break;
300
- }
301
- } catch (err) {
302
- logError(wrapError(err as Error, {
303
- additional: {
304
- action: typed.type
331
+ // MVP: Other action types deferred (timer, animator, etc.)
332
+ default:
333
+ break;
305
334
  }
306
- }));
335
+ } catch (err) {
336
+ logError(
337
+ wrapError(err as Error, {
338
+ additional: {
339
+ action: typed.type
340
+ }
341
+ })
342
+ );
343
+ }
307
344
  }
308
- }
309
345
 
310
- // Handle URL actions
311
- if (processUrls && action.url && onCustomAction) {
312
- onCustomAction(action as Action & { url: string });
346
+ // Handle URL actions
347
+ if (processUrls && action.url && onCustomAction) {
348
+ onCustomAction(action as Action & { url: string });
349
+ }
313
350
  }
314
- }
315
- }, [variables, logError, onStat, onCustomAction, setVariable]);
351
+ },
352
+ [variables, logError, onStat, onCustomAction, setVariable]
353
+ );
316
354
 
317
355
  // Component registration
318
356
  const registerComponent = useCallback((_componentId: string, context: ComponentContext): void => {
@@ -324,89 +362,98 @@ export function DivKit({
324
362
  }, []);
325
363
 
326
364
  // State Context implementation
327
- const stateContextValue = useMemo<StateContextValue>(() => ({
328
- registerState: (componentId: string, setState: StateSetter): (() => void) => {
329
- statesMap.current.set(componentId, setState);
330
- return () => {
331
- statesMap.current.delete(componentId);
332
- };
333
- },
365
+ const stateContextValue = useMemo<StateContextValue>(
366
+ () => ({
367
+ registerState: (componentId: string, setState: StateSetter): (() => void) => {
368
+ statesMap.current.set(componentId, setState);
369
+ return () => {
370
+ statesMap.current.delete(componentId);
371
+ };
372
+ },
334
373
 
335
- switchState: async (stateId: string): Promise<void> => {
336
- const setter = statesMap.current.get(stateId);
337
- if (setter) {
338
- await setter(stateId);
339
- }
340
- },
374
+ switchState: async (stateId: string): Promise<void> => {
375
+ const setter = statesMap.current.get(stateId);
376
+ if (setter) {
377
+ await setter(stateId);
378
+ }
379
+ },
341
380
 
342
- getStateSetter: (componentId: string): StateSetter | undefined => {
343
- return statesMap.current.get(componentId);
344
- },
381
+ getStateSetter: (componentId: string): StateSetter | undefined => {
382
+ return statesMap.current.get(componentId);
383
+ },
345
384
 
346
- registerChild: (_componentId: string): void => {
347
- // MVP: Simplified implementation
348
- // Full transition tracking deferred
349
- },
385
+ registerChild: (_componentId: string): void => {
386
+ // MVP: Simplified implementation
387
+ // Full transition tracking deferred
388
+ },
350
389
 
351
- unregisterChild: (_componentId: string): void => {
352
- // MVP: Simplified implementation
353
- },
390
+ unregisterChild: (_componentId: string): void => {
391
+ // MVP: Simplified implementation
392
+ },
354
393
 
355
- hasTransitionChange: (): boolean => {
356
- // MVP: Always false (transitions deferred)
357
- return false;
358
- }
359
- }), []);
394
+ hasTransitionChange: (): boolean => {
395
+ // MVP: Always false (transitions deferred)
396
+ return false;
397
+ }
398
+ }),
399
+ []
400
+ );
360
401
 
361
402
  // Action Context implementation
362
- const actionContextValue = useMemo<ActionContextValue>(() => ({
363
- hasAction: (): boolean => {
364
- // MVP: Simplified - always return false
365
- // Full action tracking deferred
366
- return false;
367
- }
368
- }), []);
403
+ const actionContextValue = useMemo<ActionContextValue>(
404
+ () => ({
405
+ hasAction: (): boolean => {
406
+ // MVP: Simplified - always return false
407
+ // Full action tracking deferred
408
+ return false;
409
+ }
410
+ }),
411
+ []
412
+ );
369
413
 
370
414
  // DivKit Context implementation
371
- const divKitContextValue = useMemo<DivKitContextValue>(() => ({
372
- logStat: (type: string, action: MaybeMissing<Action>) => {
373
- if (onStat && action && action.log_id) {
374
- onStat({ type, action: action as Action });
375
- }
376
- },
415
+ const divKitContextValue = useMemo<DivKitContextValue>(
416
+ () => ({
417
+ logStat: (type: string, action: MaybeMissing<Action>) => {
418
+ if (onStat && action && action.log_id) {
419
+ onStat({ type, action: action as Action });
420
+ }
421
+ },
377
422
 
378
- execCustomAction: (action: Action & { url: string }) => {
379
- if (onCustomAction) {
380
- onCustomAction(action);
381
- }
382
- },
423
+ execCustomAction: (action: Action & { url: string }) => {
424
+ if (onCustomAction) {
425
+ onCustomAction(action);
426
+ }
427
+ },
428
+
429
+ direction,
430
+ platform,
431
+
432
+ variables,
433
+ getVariable,
434
+ setVariable,
435
+
436
+ registerComponent,
437
+ unregisterComponent,
383
438
 
384
- direction,
385
- platform,
386
-
387
- variables,
388
- getVariable,
389
- setVariable,
390
-
391
- registerComponent,
392
- unregisterComponent,
393
-
394
- execAnyActions,
395
-
396
- genId
397
- }), [
398
- onStat,
399
- onCustomAction,
400
- direction,
401
- platform,
402
- variables,
403
- getVariable,
404
- setVariable,
405
- registerComponent,
406
- unregisterComponent,
407
- execAnyActions,
408
- genId
409
- ]);
439
+ execAnyActions,
440
+
441
+ genId
442
+ }),
443
+ [
444
+ onStat,
445
+ onCustomAction,
446
+ direction,
447
+ platform,
448
+ variables,
449
+ getVariable,
450
+ setVariable,
451
+ registerComponent,
452
+ unregisterComponent,
453
+ execAnyActions,
454
+ genId
455
+ ]
456
+ );
410
457
 
411
458
  // Create root component context
412
459
  const rootComponentContext = useMemo<ComponentContext<DivBaseData> | null>(() => {
@@ -443,13 +490,8 @@ export function DivKit({
443
490
  return evalExpression(allVars, undefined, store, expr, opts);
444
491
  },
445
492
 
446
- produceChildContext: (
447
- div: MaybeMissing<DivBaseData>,
448
- opts?: any
449
- ): ComponentContext => {
450
- const childPath = opts?.path !== undefined
451
- ? [...context.path, String(opts.path)]
452
- : context.path;
493
+ produceChildContext: (div: MaybeMissing<DivBaseData>, opts?: any): ComponentContext => {
494
+ const childPath = opts?.path !== undefined ? [...context.path, String(opts.path)] : context.path;
453
495
 
454
496
  const childContext: ComponentContext = {
455
497
  ...context,
@@ -515,11 +557,7 @@ export function DivKit({
515
557
 
516
558
  // Render
517
559
  if (!rootDiv || !rootComponentContext) {
518
- return (
519
- <View style={[styles.container, style]}>
520
- {/* Empty state - could render error UI here */}
521
- </View>
522
- );
560
+ return <View style={[styles.container, style]}>{/* Empty state - could render error UI here */}</View>;
523
561
  }
524
562
 
525
563
  return (