react-native-divkit 1.2.0 → 1.3.0
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/README.md +64 -2
- package/dist/components/text/DivText.d.ts.map +1 -1
- package/dist/components/text/DivText.js +24 -3
- package/dist/components/text/DivText.js.map +1 -1
- package/dist/components/utilities/Outer.d.ts +2 -2
- package/dist/components/utilities/Outer.d.ts.map +1 -1
- package/dist/components/utilities/Outer.js +132 -25
- package/dist/components/utilities/Outer.js.map +1 -1
- package/dist/utils/flattenAnimation.d.ts +4 -0
- package/dist/utils/flattenAnimation.d.ts.map +1 -0
- package/dist/utils/flattenAnimation.js +13 -0
- package/dist/utils/flattenAnimation.js.map +1 -0
- package/package.json +1 -1
- package/src/components/text/DivText.tsx +31 -4
- package/src/components/utilities/Outer.tsx +172 -26
- package/src/types/actionable.d.ts +15 -0
- package/src/types/animation.d.ts +19 -0
- package/src/utils/flattenAnimation.ts +16 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ DivKit — это фреймворк для построения UI на осн
|
|
|
11
11
|
|
|
12
12
|
## Статус
|
|
13
13
|
|
|
14
|
-
**MVP
|
|
14
|
+
**MVP**
|
|
15
15
|
|
|
16
16
|
| Функция | Статус |
|
|
17
17
|
| ------------------- | ----------- |
|
|
@@ -23,6 +23,7 @@ DivKit — это фреймворк для построения UI на осн
|
|
|
23
23
|
| Движок выражений | ✅ Готово |
|
|
24
24
|
| Обработчики действий| ✅ Готово |
|
|
25
25
|
| Подстановка шаблонов| ✅ Готово |
|
|
26
|
+
| Анимации нажатия | ✅ Готово |
|
|
26
27
|
|
|
27
28
|
## Скриншоты
|
|
28
29
|
|
|
@@ -241,6 +242,67 @@ export default function App() {
|
|
|
241
242
|
}
|
|
242
243
|
```
|
|
243
244
|
|
|
245
|
+
## Анимации нажатия (Action Animation)
|
|
246
|
+
|
|
247
|
+
Компоненты с действиями могут иметь анимацию при нажатии. Поддерживаются анимации `fade` (прозрачность), `scale` (масштаб) и их комбинация через `set`.
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"type": "text",
|
|
252
|
+
"text": "Нажми меня",
|
|
253
|
+
"actions": [
|
|
254
|
+
{
|
|
255
|
+
"log_id": "button_tap",
|
|
256
|
+
"url": "div-action://tap"
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"action_animation": {
|
|
260
|
+
"name": "fade",
|
|
261
|
+
"start_value": 1,
|
|
262
|
+
"end_value": 0.4,
|
|
263
|
+
"duration": 500,
|
|
264
|
+
"interpolator": "ease_in_out"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Комбинированная анимация (Set)
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"action_animation": {
|
|
274
|
+
"name": "set",
|
|
275
|
+
"items": [
|
|
276
|
+
{
|
|
277
|
+
"name": "fade",
|
|
278
|
+
"start_value": 1,
|
|
279
|
+
"end_value": 0.2,
|
|
280
|
+
"duration": 300,
|
|
281
|
+
"interpolator": "ease_in_out"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "scale",
|
|
285
|
+
"start_value": 1,
|
|
286
|
+
"end_value": 0.5,
|
|
287
|
+
"duration": 500,
|
|
288
|
+
"interpolator": "ease_in_out"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Параметры анимации
|
|
296
|
+
|
|
297
|
+
| Параметр | Тип | По умолч. | Описание |
|
|
298
|
+
| -------------- | ------- | ------------ | --------------------------- |
|
|
299
|
+
| `name` | string | — | `fade`, `scale`, `set`, `native`, `no_animation` |
|
|
300
|
+
| `start_value` | number | `1` | Начальное значение |
|
|
301
|
+
| `end_value` | number | `1` | Конечное значение |
|
|
302
|
+
| `duration` | number | `300` | Длительность в миллисекундах|
|
|
303
|
+
| `start_delay` | number | `0` | Задержка перед стартом |
|
|
304
|
+
| `interpolator` | string | `ease_in_out`| `linear`, `ease`, `ease_in`, `ease_out`, `ease_in_out`, `spring` |
|
|
305
|
+
|
|
244
306
|
## Свойства (Props)
|
|
245
307
|
|
|
246
308
|
| Свойство | Тип | Обязательно | Описание |
|
|
@@ -297,7 +359,7 @@ npm run ios # или npm run android
|
|
|
297
359
|
- Input (Ввод), Select (Выбор), Switch (Переключатель)
|
|
298
360
|
- Видео, Lottie-анимации
|
|
299
361
|
- Диапазоны текста, сложные градиенты
|
|
300
|
-
- Продвинутые переходы
|
|
362
|
+
- Продвинутые переходы (transition_in/transition_out)
|
|
301
363
|
- API пользовательских компонентов
|
|
302
364
|
|
|
303
365
|
## Архитектура
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DivText.d.ts","sourceRoot":"","sources":["../../../src/components/text/DivText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,YAAY;IACzB,gBAAgB,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,EAAE,gBAAgB,EAAE,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"DivText.d.ts","sourceRoot":"","sources":["../../../src/components/text/DivText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,YAAY;IACzB,gBAAgB,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,EAAE,gBAAgB,EAAE,EAAE,YAAY,qBA2LzD"}
|
|
@@ -31,6 +31,7 @@ export function DivText({ componentContext }) {
|
|
|
31
31
|
const fontSize = useDerivedFromVarsSimple(json.font_size || 12, variables || new Map());
|
|
32
32
|
const textColor = useDerivedFromVarsSimple(json.text_color || '#000000', variables || new Map());
|
|
33
33
|
const textAlignmentHorizontal = useDerivedFromVarsSimple(json.text_alignment_horizontal || 'start', variables || new Map());
|
|
34
|
+
const textAlignmentVertical = useDerivedFromVarsSimple(json.text_alignment_vertical || 'top', variables || new Map());
|
|
34
35
|
const fontSizeUnit = useDerivedFromVarsSimple(json.font_size_unit || 'sp', variables || new Map());
|
|
35
36
|
const maxLines = useDerivedFromVarsSimple(json.max_lines, variables || new Map());
|
|
36
37
|
// Convert size value based on font_size_unit
|
|
@@ -147,9 +148,29 @@ export function DivText({ componentContext }) {
|
|
|
147
148
|
}
|
|
148
149
|
return undefined;
|
|
149
150
|
}, [json.truncate, numberOfLines]);
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
|
|
151
|
+
// Build wrapper style for text block alignment inside the Outer container
|
|
152
|
+
// In Web, .text is display:flex with justify-content (halign) and align-items (valign)
|
|
153
|
+
// In RN (column layout): justifyContent = vertical, alignItems = horizontal
|
|
154
|
+
const outerStyle = useMemo(() => {
|
|
155
|
+
const style = {};
|
|
156
|
+
// Vertical alignment of text block
|
|
157
|
+
switch (textAlignmentVertical) {
|
|
158
|
+
case 'center':
|
|
159
|
+
style.justifyContent = 'center';
|
|
160
|
+
break;
|
|
161
|
+
case 'bottom':
|
|
162
|
+
style.justifyContent = 'flex-end';
|
|
163
|
+
break;
|
|
164
|
+
case 'baseline':
|
|
165
|
+
style.justifyContent = 'flex-end';
|
|
166
|
+
break;
|
|
167
|
+
default: // top
|
|
168
|
+
style.justifyContent = 'flex-start';
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
return style;
|
|
172
|
+
}, [textAlignmentVertical]);
|
|
173
|
+
return (<Outer componentContext={componentContext} style={outerStyle}>
|
|
153
174
|
<Text style={textStyle} numberOfLines={numberOfLines} ellipsizeMode={ellipsizeMode} allowFontScaling={allowFontScaling}>
|
|
154
175
|
{text}
|
|
155
176
|
</Text>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DivText.js","sourceRoot":"","sources":["../../../src/components/text/DivText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"DivText.js","sourceRoot":"","sources":["../../../src/components/text/DivText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAM/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,gBAAgB,EAAgB;IACtD,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC3D,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,gBAAgB,CAAC;IAE7C,4EAA4E;IAC5E,MAAM,IAAI,GAAG,wBAAwB,CAAS,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,SAAS,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;IAEvF,MAAM,QAAQ,GAAG,wBAAwB,CAAS,IAAI,CAAC,SAAS,IAAI,EAAE,EAAE,SAAS,IAAI,IAAI,GAAG,EAAE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UAAU,CAAC;gBAClC,MAAM;YACV,SAAS,MAAM;gBACX,KAAK,CAAC,cAAc,GAAG,YAAY,CAAC;gBACpC,MAAM;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE5B,OAAO,CACH,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CACzD;YAAA,CAAC,IAAI,CACD,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAEnC;gBAAA,CAAC,IAAI,CACT;YAAA,EAAE,IAAI,CACV;QAAA,EAAE,KAAK,CAAC,CACX,CAAC;AACN,CAAC"}
|
|
@@ -9,9 +9,9 @@ export interface OuterProps<T extends DivBaseData = DivBaseData> {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Outer component - base wrapper for all DivKit components
|
|
12
|
-
* Handles visibility, sizing, padding, margins, background, borders, and
|
|
12
|
+
* Handles visibility, sizing, padding, margins, background, borders, actions and action_animation
|
|
13
13
|
*
|
|
14
|
-
* Based on Web Outer.svelte
|
|
14
|
+
* Based on Web Outer.svelte
|
|
15
15
|
*/
|
|
16
16
|
export declare function Outer<T extends DivBaseData = DivBaseData>({ componentContext, children, style: customStyle }: OuterProps<T>): React.JSX.Element | null;
|
|
17
17
|
//# sourceMappingURL=Outer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Outer.d.ts","sourceRoot":"","sources":["../../../src/components/utilities/Outer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Outer.d.ts","sourceRoot":"","sources":["../../../src/components/utilities/Outer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAC;AACvE,OAAO,EAA6B,SAAS,EAAsC,MAAM,cAAc,CAAC;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqFpD,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC3D,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,EACvD,gBAAgB,EAChB,QAAQ,EACR,KAAK,EAAE,WAAW,EACrB,EAAE,UAAU,CAAC,CAAC,CAAC,4BAsSf"}
|
|
@@ -1,22 +1,78 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { View, Pressable, StyleSheet } from 'react-native';
|
|
1
|
+
import React, { useMemo, useRef, useCallback } from 'react';
|
|
2
|
+
import { View, Pressable, Animated, StyleSheet, Easing } from 'react-native';
|
|
3
3
|
import { useDerivedFromVarsSimple } from '../../hooks/useDerivedFromVars';
|
|
4
4
|
import { useActionHandler, useHasActions } from '../../hooks/useAction';
|
|
5
5
|
import { useDivKitContext } from '../../context/DivKitContext';
|
|
6
6
|
import { useLayoutParams } from '../../context/LayoutParamsContext';
|
|
7
7
|
import { Background } from './Background';
|
|
8
|
+
import { flattenAnimation } from '../../utils/flattenAnimation';
|
|
9
|
+
function resolveAlignSelf(alignment, dir) {
|
|
10
|
+
if (!alignment)
|
|
11
|
+
return undefined;
|
|
12
|
+
switch (alignment) {
|
|
13
|
+
case 'center':
|
|
14
|
+
return 'center';
|
|
15
|
+
case 'left':
|
|
16
|
+
return dir === 'rtl' ? 'flex-end' : 'flex-start';
|
|
17
|
+
case 'right':
|
|
18
|
+
return dir === 'rtl' ? 'flex-start' : 'flex-end';
|
|
19
|
+
case 'start':
|
|
20
|
+
return 'flex-start';
|
|
21
|
+
case 'end':
|
|
22
|
+
return 'flex-end';
|
|
23
|
+
default:
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function interpolationToEasing(interpolator) {
|
|
28
|
+
switch (interpolator) {
|
|
29
|
+
case 'linear':
|
|
30
|
+
return Easing.linear;
|
|
31
|
+
case 'ease':
|
|
32
|
+
return Easing.ease;
|
|
33
|
+
case 'ease_in':
|
|
34
|
+
return Easing.in(Easing.ease);
|
|
35
|
+
case 'ease_out':
|
|
36
|
+
return Easing.out(Easing.ease);
|
|
37
|
+
case 'ease_in_out':
|
|
38
|
+
return Easing.inOut(Easing.ease);
|
|
39
|
+
case 'spring':
|
|
40
|
+
return Easing.inOut(Easing.ease);
|
|
41
|
+
default:
|
|
42
|
+
return Easing.inOut(Easing.ease);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function parseActionAnimations(animation) {
|
|
46
|
+
if (!animation)
|
|
47
|
+
return [];
|
|
48
|
+
const list = flattenAnimation(animation);
|
|
49
|
+
const result = [];
|
|
50
|
+
for (const anim of list) {
|
|
51
|
+
if (anim.name === 'fade' || anim.name === 'scale') {
|
|
52
|
+
result.push({
|
|
53
|
+
type: anim.name,
|
|
54
|
+
startValue: anim.start_value ?? 1,
|
|
55
|
+
endValue: anim.end_value ?? 1,
|
|
56
|
+
duration: Math.max(0, anim.duration ?? 300),
|
|
57
|
+
startDelay: Math.max(0, anim.start_delay ?? 0),
|
|
58
|
+
easing: interpolationToEasing(anim.interpolator),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// 'native' and 'no_animation' are ignored
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
8
65
|
/**
|
|
9
66
|
* Outer component - base wrapper for all DivKit components
|
|
10
|
-
* Handles visibility, sizing, padding, margins, background, borders, and
|
|
67
|
+
* Handles visibility, sizing, padding, margins, background, borders, actions and action_animation
|
|
11
68
|
*
|
|
12
|
-
* Based on Web Outer.svelte
|
|
69
|
+
* Based on Web Outer.svelte
|
|
13
70
|
*/
|
|
14
71
|
export function Outer({ componentContext, children, style: customStyle }) {
|
|
15
72
|
const { direction } = useDivKitContext();
|
|
16
73
|
const layoutParams = useLayoutParams();
|
|
17
74
|
const { json, variables } = componentContext;
|
|
18
75
|
// Only use reactive hooks for truly dynamic properties (visibility, alpha)
|
|
19
|
-
// For MVP, other properties are read directly from JSON (can be enhanced later)
|
|
20
76
|
const visibility = useDerivedFromVarsSimple(json.visibility || 'visible', variables || new Map());
|
|
21
77
|
const alpha = useDerivedFromVarsSimple(json.alpha !== undefined ? json.alpha : 1, variables || new Map());
|
|
22
78
|
// Paddings and margins need expression evaluation (e.g. @{safeAreaTop})
|
|
@@ -26,11 +82,53 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
26
82
|
const border = useDerivedFromVarsSimple(json.border, variables || new Map());
|
|
27
83
|
const width = useDerivedFromVarsSimple(json.width, variables || new Map());
|
|
28
84
|
const height = useDerivedFromVarsSimple(json.height, variables || new Map());
|
|
29
|
-
|
|
85
|
+
const alignmentHorizontal = useDerivedFromVarsSimple(json.alignment_horizontal, variables || new Map());
|
|
86
|
+
const alignmentVertical = useDerivedFromVarsSimple(json.alignment_vertical, variables || new Map());
|
|
87
|
+
// Actions
|
|
30
88
|
const jsonAny = json;
|
|
31
89
|
const actions = jsonAny.actions || (jsonAny.action ? [jsonAny.action] : []);
|
|
32
90
|
const hasActions = useHasActions(actions);
|
|
33
91
|
const handlePress = useActionHandler(actions, { componentContext });
|
|
92
|
+
// Action animation
|
|
93
|
+
const actionAnimation = jsonAny.action_animation;
|
|
94
|
+
const parsedAnimations = useMemo(() => parseActionAnimations(actionAnimation), [actionAnimation]);
|
|
95
|
+
const hasFadeAnimation = parsedAnimations.some(a => a.type === 'fade');
|
|
96
|
+
const hasScaleAnimation = parsedAnimations.some(a => a.type === 'scale');
|
|
97
|
+
// Animated values (created once, stable refs)
|
|
98
|
+
const animOpacity = useRef(new Animated.Value(1)).current;
|
|
99
|
+
const animScale = useRef(new Animated.Value(1)).current;
|
|
100
|
+
const onPressIn = useCallback(() => {
|
|
101
|
+
if (parsedAnimations.length === 0)
|
|
102
|
+
return;
|
|
103
|
+
const anims = [];
|
|
104
|
+
for (const anim of parsedAnimations) {
|
|
105
|
+
const target = anim.type === 'fade' ? animOpacity : animScale;
|
|
106
|
+
anims.push(Animated.timing(target, {
|
|
107
|
+
toValue: anim.endValue,
|
|
108
|
+
duration: anim.duration,
|
|
109
|
+
delay: anim.startDelay,
|
|
110
|
+
easing: anim.easing,
|
|
111
|
+
useNativeDriver: true,
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
Animated.parallel(anims).start();
|
|
115
|
+
}, [parsedAnimations, animOpacity, animScale]);
|
|
116
|
+
const onPressOut = useCallback(() => {
|
|
117
|
+
if (parsedAnimations.length === 0)
|
|
118
|
+
return;
|
|
119
|
+
const anims = [];
|
|
120
|
+
for (const anim of parsedAnimations) {
|
|
121
|
+
const target = anim.type === 'fade' ? animOpacity : animScale;
|
|
122
|
+
anims.push(Animated.timing(target, {
|
|
123
|
+
toValue: anim.startValue,
|
|
124
|
+
duration: anim.duration,
|
|
125
|
+
delay: anim.startDelay,
|
|
126
|
+
easing: anim.easing,
|
|
127
|
+
useNativeDriver: true,
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
Animated.parallel(anims).start();
|
|
131
|
+
}, [parsedAnimations, animOpacity, animScale]);
|
|
34
132
|
// Early return for gone visibility
|
|
35
133
|
if (visibility === 'gone') {
|
|
36
134
|
return null;
|
|
@@ -54,20 +152,18 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
54
152
|
}
|
|
55
153
|
else if (widthVal.type === 'match_parent') {
|
|
56
154
|
styles.alignSelf = 'stretch';
|
|
57
|
-
// flexGrow only on the main axis (horizontal parent)
|
|
58
155
|
if (parentOrientation === 'horizontal') {
|
|
59
156
|
styles.flexGrow = widthVal.weight || 1;
|
|
60
157
|
styles.flexShrink = 1;
|
|
61
158
|
}
|
|
62
159
|
}
|
|
63
160
|
else if (widthVal.type === 'wrap_content') {
|
|
64
|
-
|
|
161
|
+
const hAlign = resolveAlignSelf(alignmentHorizontal, direction);
|
|
162
|
+
styles.alignSelf = hAlign || 'flex-start';
|
|
65
163
|
}
|
|
66
164
|
}
|
|
67
165
|
else {
|
|
68
|
-
// Default: match_parent
|
|
69
166
|
styles.alignSelf = 'stretch';
|
|
70
|
-
// flexGrow only on the main axis (horizontal parent) or outside a container
|
|
71
167
|
if (!parentOrientation || parentOrientation === 'horizontal') {
|
|
72
168
|
styles.flexGrow = 1;
|
|
73
169
|
styles.flexShrink = 1;
|
|
@@ -80,16 +176,13 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
80
176
|
styles.height = heightVal.value;
|
|
81
177
|
}
|
|
82
178
|
else if (heightVal.type === 'match_parent') {
|
|
83
|
-
// flexGrow only on the main axis (vertical parent)
|
|
84
179
|
if (parentOrientation === 'vertical') {
|
|
85
180
|
styles.flexGrow = heightVal.weight || 1;
|
|
86
181
|
}
|
|
87
182
|
else {
|
|
88
|
-
// Cross axis — stretch via alignSelf or explicit height
|
|
89
183
|
styles.alignSelf = 'stretch';
|
|
90
184
|
}
|
|
91
185
|
}
|
|
92
|
-
// wrap_content is default in React Native
|
|
93
186
|
}
|
|
94
187
|
// Paddings
|
|
95
188
|
if (paddings) {
|
|
@@ -98,7 +191,6 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
98
191
|
styles.paddingTop = p.top;
|
|
99
192
|
if (p.bottom !== undefined)
|
|
100
193
|
styles.paddingBottom = p.bottom;
|
|
101
|
-
// Handle RTL for start/end
|
|
102
194
|
if (direction === 'rtl') {
|
|
103
195
|
if (p.start !== undefined)
|
|
104
196
|
styles.paddingRight = p.start;
|
|
@@ -111,7 +203,6 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
111
203
|
if (p.end !== undefined)
|
|
112
204
|
styles.paddingRight = p.end;
|
|
113
205
|
}
|
|
114
|
-
// Fallback to left/right if start/end not provided
|
|
115
206
|
if (p.left !== undefined && p.start === undefined) {
|
|
116
207
|
styles.paddingLeft = p.left;
|
|
117
208
|
}
|
|
@@ -126,7 +217,6 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
126
217
|
styles.marginTop = m.top;
|
|
127
218
|
if (m.bottom !== undefined)
|
|
128
219
|
styles.marginBottom = m.bottom;
|
|
129
|
-
// Handle RTL for start/end
|
|
130
220
|
if (direction === 'rtl') {
|
|
131
221
|
if (m.start !== undefined)
|
|
132
222
|
styles.marginRight = m.start;
|
|
@@ -139,7 +229,6 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
139
229
|
if (m.end !== undefined)
|
|
140
230
|
styles.marginRight = m.end;
|
|
141
231
|
}
|
|
142
|
-
// Fallback to left/right
|
|
143
232
|
if (m.left !== undefined && m.start === undefined) {
|
|
144
233
|
styles.marginLeft = m.left;
|
|
145
234
|
}
|
|
@@ -147,7 +236,6 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
147
236
|
styles.marginRight = m.right;
|
|
148
237
|
}
|
|
149
238
|
}
|
|
150
|
-
// Background handled by Background component
|
|
151
239
|
// Border
|
|
152
240
|
if (border) {
|
|
153
241
|
const b = border;
|
|
@@ -158,12 +246,10 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
158
246
|
styles.borderColor = strokeColor;
|
|
159
247
|
styles.borderStyle = b.stroke.style?.type === 'dashed' ? 'dashed' : 'solid';
|
|
160
248
|
}
|
|
161
|
-
// Border radius
|
|
162
249
|
if (b.corner_radius !== undefined) {
|
|
163
250
|
styles.borderRadius = b.corner_radius;
|
|
164
251
|
}
|
|
165
252
|
else if (b.corners_radius) {
|
|
166
|
-
// React Native supports individual corners
|
|
167
253
|
const corners = b.corners_radius;
|
|
168
254
|
if (corners['top-left'] !== undefined) {
|
|
169
255
|
styles.borderTopLeftRadius = corners['top-left'];
|
|
@@ -178,7 +264,6 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
178
264
|
styles.borderBottomRightRadius = corners['bottom-right'];
|
|
179
265
|
}
|
|
180
266
|
}
|
|
181
|
-
// Shadow (box-shadow equivalent)
|
|
182
267
|
if (b.has_shadow) {
|
|
183
268
|
const shadow = b.shadow;
|
|
184
269
|
if (shadow) {
|
|
@@ -189,11 +274,9 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
189
274
|
};
|
|
190
275
|
styles.shadowOpacity = shadow.alpha !== undefined ? shadow.alpha : 0.18;
|
|
191
276
|
styles.shadowRadius = shadow.blur || 2;
|
|
192
|
-
// Android elevation
|
|
193
277
|
styles.elevation = 3;
|
|
194
278
|
}
|
|
195
279
|
else {
|
|
196
|
-
// Default shadow
|
|
197
280
|
styles.shadowColor = '#000000';
|
|
198
281
|
styles.shadowOffset = { width: 0, height: 1 };
|
|
199
282
|
styles.shadowOpacity = 0.18;
|
|
@@ -203,7 +286,7 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
203
286
|
}
|
|
204
287
|
}
|
|
205
288
|
return styles;
|
|
206
|
-
}, [visibility, alpha, width, height, paddings, margins, background, border, direction, layoutParams]);
|
|
289
|
+
}, [visibility, alpha, width, height, paddings, margins, background, border, direction, layoutParams, alignmentHorizontal, alignmentVertical]);
|
|
207
290
|
const finalStyle = useMemo(() => {
|
|
208
291
|
return StyleSheet.flatten([containerStyle, customStyle]);
|
|
209
292
|
}, [containerStyle, customStyle]);
|
|
@@ -222,8 +305,32 @@ export function Outer({ componentContext, children, style: customStyle }) {
|
|
|
222
305
|
res.borderBottomRightRadius = s.borderBottomRightRadius;
|
|
223
306
|
return res;
|
|
224
307
|
}, [finalStyle]);
|
|
225
|
-
// Render with
|
|
308
|
+
// Render with actions and animation
|
|
226
309
|
if (hasActions) {
|
|
310
|
+
const hasAnimation = parsedAnimations.length > 0;
|
|
311
|
+
if (hasAnimation) {
|
|
312
|
+
// Build animated style with opacity/scale overrides
|
|
313
|
+
const animatedStyle = { ...finalStyle };
|
|
314
|
+
if (hasFadeAnimation) {
|
|
315
|
+
const staticOpacity = animatedStyle.opacity;
|
|
316
|
+
if (staticOpacity !== undefined && staticOpacity !== 1) {
|
|
317
|
+
animatedStyle.opacity = Animated.multiply(animOpacity, staticOpacity);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
animatedStyle.opacity = animOpacity;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (hasScaleAnimation) {
|
|
324
|
+
const existingTransform = animatedStyle.transform || [];
|
|
325
|
+
animatedStyle.transform = [...existingTransform, { scale: animScale }];
|
|
326
|
+
}
|
|
327
|
+
return (<Pressable onPress={handlePress} onPressIn={onPressIn} onPressOut={onPressOut} style={{ alignSelf: finalStyle?.alignSelf, flexGrow: finalStyle?.flexGrow, flexShrink: finalStyle?.flexShrink }}>
|
|
328
|
+
<Animated.View style={animatedStyle}>
|
|
329
|
+
<Background layers={background} style={borderStyle}/>
|
|
330
|
+
{children}
|
|
331
|
+
</Animated.View>
|
|
332
|
+
</Pressable>);
|
|
333
|
+
}
|
|
227
334
|
return (<Pressable onPress={handlePress} style={finalStyle}>
|
|
228
335
|
<Background layers={background} style={borderStyle}/>
|
|
229
336
|
{children}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Outer.js","sourceRoot":"","sources":["../../../src/components/utilities/Outer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AAMtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAA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,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAChC;wBAAA,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,UAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAC1D;wBAAA,CAAC,QAAQ,CACb;oBAAA,EAAE,QAAQ,CAAC,IAAI,CACnB;gBAAA,EAAE,SAAS,CAAC,CACf,CAAC;QACN,CAAC;QAED,OAAO,CACH,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAC/C;gBAAA,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,UAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAC1D;gBAAA,CAAC,QAAQ,CACb;YAAA,EAAE,SAAS,CAAC,CACf,CAAC;IACN,CAAC;IAED,OAAO,CACH,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CACpB;YAAA,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,UAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAC1D;YAAA,CAAC,QAAQ,CACb;QAAA,EAAE,IAAI,CAAC,CACV,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MaybeMissing } from '../expressions/json';
|
|
2
|
+
import type { Animation, AnyAnimation } from '../types/animation';
|
|
3
|
+
export declare function flattenAnimation(animation: MaybeMissing<Animation>): MaybeMissing<AnyAnimation>[];
|
|
4
|
+
//# sourceMappingURL=flattenAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenAnimation.d.ts","sourceRoot":"","sources":["../../src/utils/flattenAnimation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,YAAY,CAAC,EAAE,CAYjG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function flattenAnimation(animation) {
|
|
2
|
+
const res = [];
|
|
3
|
+
if (animation.name === 'set') {
|
|
4
|
+
(animation.items || []).forEach(item => {
|
|
5
|
+
res.push(...flattenAnimation(item));
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
res.push(animation);
|
|
10
|
+
}
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=flattenAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenAnimation.js","sourceRoot":"","sources":["../../src/utils/flattenAnimation.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,gBAAgB,CAAC,SAAkC;IAC/D,MAAM,GAAG,GAAiC,EAAE,CAAC;IAE7C,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC3B,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnC,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACP,CAAC;SAAM,CAAC;QACJ,GAAG,CAAC,IAAI,CAAC,SAAuC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { PixelRatio, Text, TextStyle } from 'react-native';
|
|
2
|
+
import { PixelRatio, Text, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import type { ComponentContext } from '../../types/componentContext';
|
|
4
4
|
import type { DivTextData, FontSizeUnit, FontWeight, Truncate } from '../../types/text';
|
|
5
5
|
import { Outer } from '../utilities/Outer';
|
|
@@ -46,6 +46,11 @@ export function DivText({ componentContext }: DivTextProps) {
|
|
|
46
46
|
variables || new Map()
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
+
const textAlignmentVertical = useDerivedFromVarsSimple(
|
|
50
|
+
json.text_alignment_vertical || 'top',
|
|
51
|
+
variables || new Map()
|
|
52
|
+
);
|
|
53
|
+
|
|
49
54
|
const fontSizeUnit = useDerivedFromVarsSimple<FontSizeUnit>(json.font_size_unit || 'sp', variables || new Map());
|
|
50
55
|
|
|
51
56
|
const maxLines = useDerivedFromVarsSimple<number | undefined>(json.max_lines, variables || new Map());
|
|
@@ -175,11 +180,33 @@ export function DivText({ componentContext }: DivTextProps) {
|
|
|
175
180
|
return undefined;
|
|
176
181
|
}, [json.truncate, numberOfLines]);
|
|
177
182
|
|
|
178
|
-
//
|
|
179
|
-
//
|
|
183
|
+
// Build wrapper style for text block alignment inside the Outer container
|
|
184
|
+
// In Web, .text is display:flex with justify-content (halign) and align-items (valign)
|
|
185
|
+
// In RN (column layout): justifyContent = vertical, alignItems = horizontal
|
|
186
|
+
const outerStyle = useMemo((): ViewStyle => {
|
|
187
|
+
const style: ViewStyle = {};
|
|
188
|
+
|
|
189
|
+
// Vertical alignment of text block
|
|
190
|
+
switch (textAlignmentVertical) {
|
|
191
|
+
case 'center':
|
|
192
|
+
style.justifyContent = 'center';
|
|
193
|
+
break;
|
|
194
|
+
case 'bottom':
|
|
195
|
+
style.justifyContent = 'flex-end';
|
|
196
|
+
break;
|
|
197
|
+
case 'baseline':
|
|
198
|
+
style.justifyContent = 'flex-end';
|
|
199
|
+
break;
|
|
200
|
+
default: // top
|
|
201
|
+
style.justifyContent = 'flex-start';
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return style;
|
|
206
|
+
}, [textAlignmentVertical]);
|
|
180
207
|
|
|
181
208
|
return (
|
|
182
|
-
<Outer componentContext={componentContext}>
|
|
209
|
+
<Outer componentContext={componentContext} style={outerStyle}>
|
|
183
210
|
<Text
|
|
184
211
|
style={textStyle}
|
|
185
212
|
numberOfLines={numberOfLines}
|
|
@@ -1,15 +1,90 @@
|
|
|
1
|
-
import React, { ReactNode, useMemo } from 'react';
|
|
2
|
-
import { View, Pressable, ViewStyle, StyleSheet } from 'react-native';
|
|
1
|
+
import React, { ReactNode, useMemo, useRef, useCallback } from 'react';
|
|
2
|
+
import { View, Pressable, Animated, ViewStyle, StyleSheet, Easing, EasingFunction } from 'react-native';
|
|
3
3
|
import type { ComponentContext } from '../../types/componentContext';
|
|
4
4
|
import type { DivBaseData } from '../../types/base';
|
|
5
5
|
import type { Visibility } from '../../types/base';
|
|
6
6
|
import type { FixedSize, MatchParentSize } from '../../types/sizes';
|
|
7
7
|
import type { MaybeMissing } from '../../expressions/json';
|
|
8
|
+
import type { Animation } from '../../types/animation';
|
|
9
|
+
import type { Interpolation } from '../../../typings/common';
|
|
8
10
|
import { useDerivedFromVarsSimple } from '../../hooks/useDerivedFromVars';
|
|
9
11
|
import { useActionHandler, useHasActions } from '../../hooks/useAction';
|
|
10
12
|
import { useDivKitContext } from '../../context/DivKitContext';
|
|
11
13
|
import { useLayoutParams } from '../../context/LayoutParamsContext';
|
|
12
14
|
import { Background } from './Background';
|
|
15
|
+
import { flattenAnimation } from '../../utils/flattenAnimation';
|
|
16
|
+
|
|
17
|
+
function resolveAlignSelf(
|
|
18
|
+
alignment: string | undefined,
|
|
19
|
+
dir: string
|
|
20
|
+
): 'flex-start' | 'center' | 'flex-end' | undefined {
|
|
21
|
+
if (!alignment) return undefined;
|
|
22
|
+
switch (alignment) {
|
|
23
|
+
case 'center':
|
|
24
|
+
return 'center';
|
|
25
|
+
case 'left':
|
|
26
|
+
return dir === 'rtl' ? 'flex-end' : 'flex-start';
|
|
27
|
+
case 'right':
|
|
28
|
+
return dir === 'rtl' ? 'flex-start' : 'flex-end';
|
|
29
|
+
case 'start':
|
|
30
|
+
return 'flex-start';
|
|
31
|
+
case 'end':
|
|
32
|
+
return 'flex-end';
|
|
33
|
+
default:
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function interpolationToEasing(interpolator: Interpolation | undefined): EasingFunction {
|
|
39
|
+
switch (interpolator) {
|
|
40
|
+
case 'linear':
|
|
41
|
+
return Easing.linear;
|
|
42
|
+
case 'ease':
|
|
43
|
+
return Easing.ease;
|
|
44
|
+
case 'ease_in':
|
|
45
|
+
return Easing.in(Easing.ease);
|
|
46
|
+
case 'ease_out':
|
|
47
|
+
return Easing.out(Easing.ease);
|
|
48
|
+
case 'ease_in_out':
|
|
49
|
+
return Easing.inOut(Easing.ease);
|
|
50
|
+
case 'spring':
|
|
51
|
+
return Easing.inOut(Easing.ease);
|
|
52
|
+
default:
|
|
53
|
+
return Easing.inOut(Easing.ease);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ParsedActionAnimation {
|
|
58
|
+
type: 'fade' | 'scale';
|
|
59
|
+
startValue: number;
|
|
60
|
+
endValue: number;
|
|
61
|
+
duration: number;
|
|
62
|
+
startDelay: number;
|
|
63
|
+
easing: EasingFunction;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseActionAnimations(animation: MaybeMissing<Animation> | undefined): ParsedActionAnimation[] {
|
|
67
|
+
if (!animation) return [];
|
|
68
|
+
|
|
69
|
+
const list = flattenAnimation(animation);
|
|
70
|
+
const result: ParsedActionAnimation[] = [];
|
|
71
|
+
|
|
72
|
+
for (const anim of list) {
|
|
73
|
+
if (anim.name === 'fade' || anim.name === 'scale') {
|
|
74
|
+
result.push({
|
|
75
|
+
type: anim.name,
|
|
76
|
+
startValue: anim.start_value ?? 1,
|
|
77
|
+
endValue: anim.end_value ?? 1,
|
|
78
|
+
duration: Math.max(0, anim.duration ?? 300),
|
|
79
|
+
startDelay: Math.max(0, anim.start_delay ?? 0),
|
|
80
|
+
easing: interpolationToEasing(anim.interpolator),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// 'native' and 'no_animation' are ignored
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
13
88
|
|
|
14
89
|
export interface OuterProps<T extends DivBaseData = DivBaseData> {
|
|
15
90
|
componentContext: ComponentContext<T>;
|
|
@@ -19,9 +94,9 @@ export interface OuterProps<T extends DivBaseData = DivBaseData> {
|
|
|
19
94
|
|
|
20
95
|
/**
|
|
21
96
|
* Outer component - base wrapper for all DivKit components
|
|
22
|
-
* Handles visibility, sizing, padding, margins, background, borders, and
|
|
97
|
+
* Handles visibility, sizing, padding, margins, background, borders, actions and action_animation
|
|
23
98
|
*
|
|
24
|
-
* Based on Web Outer.svelte
|
|
99
|
+
* Based on Web Outer.svelte
|
|
25
100
|
*/
|
|
26
101
|
export function Outer<T extends DivBaseData = DivBaseData>({
|
|
27
102
|
componentContext,
|
|
@@ -33,7 +108,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
33
108
|
const { json, variables } = componentContext;
|
|
34
109
|
|
|
35
110
|
// Only use reactive hooks for truly dynamic properties (visibility, alpha)
|
|
36
|
-
// For MVP, other properties are read directly from JSON (can be enhanced later)
|
|
37
111
|
const visibility = useDerivedFromVarsSimple<Visibility>(json.visibility || 'visible', variables || new Map());
|
|
38
112
|
const alpha = useDerivedFromVarsSimple<number>(json.alpha !== undefined ? json.alpha : 1, variables || new Map());
|
|
39
113
|
|
|
@@ -44,13 +118,66 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
44
118
|
const border = useDerivedFromVarsSimple(json.border, variables || new Map());
|
|
45
119
|
const width = useDerivedFromVarsSimple(json.width, variables || new Map());
|
|
46
120
|
const height = useDerivedFromVarsSimple(json.height, variables || new Map());
|
|
121
|
+
const alignmentHorizontal = useDerivedFromVarsSimple(json.alignment_horizontal, variables || new Map());
|
|
122
|
+
const alignmentVertical = useDerivedFromVarsSimple(json.alignment_vertical, variables || new Map());
|
|
47
123
|
|
|
48
|
-
// Actions
|
|
124
|
+
// Actions
|
|
49
125
|
const jsonAny = json as any;
|
|
50
126
|
const actions = jsonAny.actions || (jsonAny.action ? [jsonAny.action] : []);
|
|
51
127
|
const hasActions = useHasActions(actions);
|
|
52
128
|
const handlePress = useActionHandler(actions, { componentContext });
|
|
53
129
|
|
|
130
|
+
// Action animation
|
|
131
|
+
const actionAnimation = jsonAny.action_animation as MaybeMissing<Animation> | undefined;
|
|
132
|
+
const parsedAnimations = useMemo(() => parseActionAnimations(actionAnimation), [actionAnimation]);
|
|
133
|
+
|
|
134
|
+
const hasFadeAnimation = parsedAnimations.some(a => a.type === 'fade');
|
|
135
|
+
const hasScaleAnimation = parsedAnimations.some(a => a.type === 'scale');
|
|
136
|
+
|
|
137
|
+
// Animated values (created once, stable refs)
|
|
138
|
+
const animOpacity = useRef(new Animated.Value(1)).current;
|
|
139
|
+
const animScale = useRef(new Animated.Value(1)).current;
|
|
140
|
+
|
|
141
|
+
const onPressIn = useCallback(() => {
|
|
142
|
+
if (parsedAnimations.length === 0) return;
|
|
143
|
+
|
|
144
|
+
const anims: Animated.CompositeAnimation[] = [];
|
|
145
|
+
for (const anim of parsedAnimations) {
|
|
146
|
+
const target = anim.type === 'fade' ? animOpacity : animScale;
|
|
147
|
+
anims.push(
|
|
148
|
+
Animated.timing(target, {
|
|
149
|
+
toValue: anim.endValue,
|
|
150
|
+
duration: anim.duration,
|
|
151
|
+
delay: anim.startDelay,
|
|
152
|
+
easing: anim.easing,
|
|
153
|
+
useNativeDriver: true,
|
|
154
|
+
})
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
Animated.parallel(anims).start();
|
|
159
|
+
}, [parsedAnimations, animOpacity, animScale]);
|
|
160
|
+
|
|
161
|
+
const onPressOut = useCallback(() => {
|
|
162
|
+
if (parsedAnimations.length === 0) return;
|
|
163
|
+
|
|
164
|
+
const anims: Animated.CompositeAnimation[] = [];
|
|
165
|
+
for (const anim of parsedAnimations) {
|
|
166
|
+
const target = anim.type === 'fade' ? animOpacity : animScale;
|
|
167
|
+
anims.push(
|
|
168
|
+
Animated.timing(target, {
|
|
169
|
+
toValue: anim.startValue,
|
|
170
|
+
duration: anim.duration,
|
|
171
|
+
delay: anim.startDelay,
|
|
172
|
+
easing: anim.easing,
|
|
173
|
+
useNativeDriver: true,
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
Animated.parallel(anims).start();
|
|
179
|
+
}, [parsedAnimations, animOpacity, animScale]);
|
|
180
|
+
|
|
54
181
|
// Early return for gone visibility
|
|
55
182
|
if (visibility === 'gone') {
|
|
56
183
|
return null;
|
|
@@ -76,18 +203,16 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
76
203
|
styles.width = (widthVal as FixedSize).value;
|
|
77
204
|
} else if (widthVal.type === 'match_parent') {
|
|
78
205
|
styles.alignSelf = 'stretch';
|
|
79
|
-
// flexGrow only on the main axis (horizontal parent)
|
|
80
206
|
if (parentOrientation === 'horizontal') {
|
|
81
207
|
styles.flexGrow = (widthVal as MatchParentSize).weight || 1;
|
|
82
208
|
styles.flexShrink = 1;
|
|
83
209
|
}
|
|
84
210
|
} else if (widthVal.type === 'wrap_content') {
|
|
85
|
-
|
|
211
|
+
const hAlign = resolveAlignSelf(alignmentHorizontal as string | undefined, direction);
|
|
212
|
+
styles.alignSelf = hAlign || 'flex-start';
|
|
86
213
|
}
|
|
87
214
|
} else {
|
|
88
|
-
// Default: match_parent
|
|
89
215
|
styles.alignSelf = 'stretch';
|
|
90
|
-
// flexGrow only on the main axis (horizontal parent) or outside a container
|
|
91
216
|
if (!parentOrientation || parentOrientation === 'horizontal') {
|
|
92
217
|
styles.flexGrow = 1;
|
|
93
218
|
styles.flexShrink = 1;
|
|
@@ -100,15 +225,12 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
100
225
|
if (heightVal.type === 'fixed') {
|
|
101
226
|
styles.height = (heightVal as FixedSize).value;
|
|
102
227
|
} else if (heightVal.type === 'match_parent') {
|
|
103
|
-
// flexGrow only on the main axis (vertical parent)
|
|
104
228
|
if (parentOrientation === 'vertical') {
|
|
105
229
|
styles.flexGrow = (heightVal as MatchParentSize).weight || 1;
|
|
106
230
|
} else {
|
|
107
|
-
// Cross axis — stretch via alignSelf or explicit height
|
|
108
231
|
styles.alignSelf = 'stretch';
|
|
109
232
|
}
|
|
110
233
|
}
|
|
111
|
-
// wrap_content is default in React Native
|
|
112
234
|
}
|
|
113
235
|
|
|
114
236
|
// Paddings
|
|
@@ -117,7 +239,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
117
239
|
if (p.top !== undefined) styles.paddingTop = p.top;
|
|
118
240
|
if (p.bottom !== undefined) styles.paddingBottom = p.bottom;
|
|
119
241
|
|
|
120
|
-
// Handle RTL for start/end
|
|
121
242
|
if (direction === 'rtl') {
|
|
122
243
|
if (p.start !== undefined) styles.paddingRight = p.start;
|
|
123
244
|
if (p.end !== undefined) styles.paddingLeft = p.end;
|
|
@@ -126,7 +247,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
126
247
|
if (p.end !== undefined) styles.paddingRight = p.end;
|
|
127
248
|
}
|
|
128
249
|
|
|
129
|
-
// Fallback to left/right if start/end not provided
|
|
130
250
|
if (p.left !== undefined && p.start === undefined) {
|
|
131
251
|
styles.paddingLeft = p.left;
|
|
132
252
|
}
|
|
@@ -141,7 +261,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
141
261
|
if (m.top !== undefined) styles.marginTop = m.top;
|
|
142
262
|
if (m.bottom !== undefined) styles.marginBottom = m.bottom;
|
|
143
263
|
|
|
144
|
-
// Handle RTL for start/end
|
|
145
264
|
if (direction === 'rtl') {
|
|
146
265
|
if (m.start !== undefined) styles.marginRight = m.start;
|
|
147
266
|
if (m.end !== undefined) styles.marginLeft = m.end;
|
|
@@ -150,7 +269,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
150
269
|
if (m.end !== undefined) styles.marginRight = m.end;
|
|
151
270
|
}
|
|
152
271
|
|
|
153
|
-
// Fallback to left/right
|
|
154
272
|
if (m.left !== undefined && m.start === undefined) {
|
|
155
273
|
styles.marginLeft = m.left;
|
|
156
274
|
}
|
|
@@ -159,8 +277,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
159
277
|
}
|
|
160
278
|
}
|
|
161
279
|
|
|
162
|
-
// Background handled by Background component
|
|
163
|
-
|
|
164
280
|
// Border
|
|
165
281
|
if (border) {
|
|
166
282
|
const b = border as any;
|
|
@@ -172,11 +288,9 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
172
288
|
styles.borderStyle = b.stroke.style?.type === 'dashed' ? 'dashed' : 'solid';
|
|
173
289
|
}
|
|
174
290
|
|
|
175
|
-
// Border radius
|
|
176
291
|
if (b.corner_radius !== undefined) {
|
|
177
292
|
styles.borderRadius = b.corner_radius;
|
|
178
293
|
} else if (b.corners_radius) {
|
|
179
|
-
// React Native supports individual corners
|
|
180
294
|
const corners = b.corners_radius;
|
|
181
295
|
if (corners['top-left'] !== undefined) {
|
|
182
296
|
styles.borderTopLeftRadius = corners['top-left'];
|
|
@@ -192,7 +306,6 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
192
306
|
}
|
|
193
307
|
}
|
|
194
308
|
|
|
195
|
-
// Shadow (box-shadow equivalent)
|
|
196
309
|
if (b.has_shadow) {
|
|
197
310
|
const shadow = b.shadow;
|
|
198
311
|
if (shadow) {
|
|
@@ -203,10 +316,8 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
203
316
|
};
|
|
204
317
|
styles.shadowOpacity = shadow.alpha !== undefined ? shadow.alpha : 0.18;
|
|
205
318
|
styles.shadowRadius = shadow.blur || 2;
|
|
206
|
-
// Android elevation
|
|
207
319
|
styles.elevation = 3;
|
|
208
320
|
} else {
|
|
209
|
-
// Default shadow
|
|
210
321
|
styles.shadowColor = '#000000';
|
|
211
322
|
styles.shadowOffset = { width: 0, height: 1 };
|
|
212
323
|
styles.shadowOpacity = 0.18;
|
|
@@ -217,7 +328,7 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
217
328
|
}
|
|
218
329
|
|
|
219
330
|
return styles;
|
|
220
|
-
}, [visibility, alpha, width, height, paddings, margins, background, border, direction, layoutParams]);
|
|
331
|
+
}, [visibility, alpha, width, height, paddings, margins, background, border, direction, layoutParams, alignmentHorizontal, alignmentVertical]);
|
|
221
332
|
|
|
222
333
|
const finalStyle = useMemo(() => {
|
|
223
334
|
return StyleSheet.flatten([containerStyle, customStyle]);
|
|
@@ -234,8 +345,43 @@ export function Outer<T extends DivBaseData = DivBaseData>({
|
|
|
234
345
|
return res;
|
|
235
346
|
}, [finalStyle]);
|
|
236
347
|
|
|
237
|
-
// Render with
|
|
348
|
+
// Render with actions and animation
|
|
238
349
|
if (hasActions) {
|
|
350
|
+
const hasAnimation = parsedAnimations.length > 0;
|
|
351
|
+
|
|
352
|
+
if (hasAnimation) {
|
|
353
|
+
// Build animated style with opacity/scale overrides
|
|
354
|
+
const animatedStyle: any = { ...finalStyle };
|
|
355
|
+
|
|
356
|
+
if (hasFadeAnimation) {
|
|
357
|
+
const staticOpacity = animatedStyle.opacity;
|
|
358
|
+
if (staticOpacity !== undefined && staticOpacity !== 1) {
|
|
359
|
+
animatedStyle.opacity = Animated.multiply(animOpacity, staticOpacity);
|
|
360
|
+
} else {
|
|
361
|
+
animatedStyle.opacity = animOpacity;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (hasScaleAnimation) {
|
|
366
|
+
const existingTransform = animatedStyle.transform || [];
|
|
367
|
+
animatedStyle.transform = [...existingTransform, { scale: animScale }];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return (
|
|
371
|
+
<Pressable
|
|
372
|
+
onPress={handlePress}
|
|
373
|
+
onPressIn={onPressIn}
|
|
374
|
+
onPressOut={onPressOut}
|
|
375
|
+
style={{ alignSelf: finalStyle?.alignSelf, flexGrow: finalStyle?.flexGrow, flexShrink: finalStyle?.flexShrink }}
|
|
376
|
+
>
|
|
377
|
+
<Animated.View style={animatedStyle}>
|
|
378
|
+
<Background layers={background as any} style={borderStyle} />
|
|
379
|
+
{children}
|
|
380
|
+
</Animated.View>
|
|
381
|
+
</Pressable>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
239
385
|
return (
|
|
240
386
|
<Pressable onPress={handlePress} style={finalStyle}>
|
|
241
387
|
<Background layers={background as any} style={borderStyle} />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Action } from '../../typings/common';
|
|
2
|
+
import type { Animation } from './animation';
|
|
3
|
+
|
|
4
|
+
export interface DivActionableData {
|
|
5
|
+
action?: Action;
|
|
6
|
+
actions?: Action[];
|
|
7
|
+
longtap_actions?: Action[];
|
|
8
|
+
doubletap_actions?: Action[];
|
|
9
|
+
action_animation?: Animation;
|
|
10
|
+
hover_start_actions?: Action[];
|
|
11
|
+
hover_end_actions?: Action[];
|
|
12
|
+
press_start_actions?: Action[];
|
|
13
|
+
press_end_actions?: Action[];
|
|
14
|
+
capture_focus_on_action?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Interpolation } from '../../typings/common';
|
|
2
|
+
|
|
3
|
+
export type AnimationType = 'fade' | 'scale' | 'native' | 'no_animation' | 'translate';
|
|
4
|
+
|
|
5
|
+
export interface AnyAnimation {
|
|
6
|
+
name: AnimationType;
|
|
7
|
+
duration?: number;
|
|
8
|
+
start_delay?: number;
|
|
9
|
+
start_value?: number;
|
|
10
|
+
end_value?: number;
|
|
11
|
+
interpolator?: Interpolation;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AnimationSet {
|
|
15
|
+
name: 'set';
|
|
16
|
+
items: Animation[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type Animation = AnyAnimation | AnimationSet;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MaybeMissing } from '../expressions/json';
|
|
2
|
+
import type { Animation, AnyAnimation } from '../types/animation';
|
|
3
|
+
|
|
4
|
+
export function flattenAnimation(animation: MaybeMissing<Animation>): MaybeMissing<AnyAnimation>[] {
|
|
5
|
+
const res: MaybeMissing<AnyAnimation>[] = [];
|
|
6
|
+
|
|
7
|
+
if (animation.name === 'set') {
|
|
8
|
+
(animation.items || []).forEach(item => {
|
|
9
|
+
res.push(...flattenAnimation(item));
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
res.push(animation as MaybeMissing<AnyAnimation>);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return res;
|
|
16
|
+
}
|