Skip to content

Commit d80d8fe

Browse files
author
Andrzej Antoni Kwaśniewski
committed
simplify styling
1 parent 478550e commit d80d8fe

8 files changed

Lines changed: 40 additions & 52 deletions

File tree

apps/common-app/src/new_api/complicated/velocity_test/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,17 @@ export default function App() {
6262
});
6363

6464
const animatedStyles = useAnimatedStyle(() => {
65-
const backgroundColor = interpolateColor(
66-
colorProgress.value,
67-
[0, 1],
68-
[COLORS.NAVY, COLORS.KINDA_BLUE]
69-
);
70-
7165
return {
7266
transform: [
7367
{ translateX: offsetX.value },
7468
{ translateY: offsetY.value },
7569
{ scale: withTiming(isPressed.value ? 1.2 : 1, { duration: 100 }) },
7670
],
77-
backgroundColor,
71+
backgroundColor: interpolateColor(
72+
colorProgress.value,
73+
[0, 1],
74+
[COLORS.NAVY, COLORS.KINDA_BLUE]
75+
),
7876
};
7977
});
8078

apps/common-app/src/new_api/simple/fling/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@ export default function FlingExample() {
4242
});
4343

4444
const animatedStyle = useAnimatedStyle(() => {
45-
const backgroundColor = interpolateColor(
46-
colorProgress.value,
47-
[0, 1],
48-
[COLORS.NAVY, COLORS.PURPLE]
49-
);
5045
return {
5146
transform: [{ translateX: position.value }],
52-
backgroundColor,
47+
backgroundColor: interpolateColor(
48+
colorProgress.value,
49+
[0, 1],
50+
[COLORS.NAVY, COLORS.PURPLE]
51+
),
5352
};
5453
});
5554

apps/common-app/src/new_api/simple/hover/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ export default function TapExample() {
1313
const colorProgress = useSharedValue(0);
1414

1515
const animatedStyle = useAnimatedStyle(() => {
16-
const backgroundColor = interpolateColor(
17-
colorProgress.value,
18-
[0, 1],
19-
[COLORS.NAVY, COLORS.KINDA_BLUE]
20-
);
2116
return {
22-
backgroundColor,
17+
backgroundColor: interpolateColor(
18+
colorProgress.value,
19+
[0, 1],
20+
[COLORS.NAVY, COLORS.KINDA_BLUE]
21+
),
2322
};
2423
});
2524

apps/common-app/src/new_api/simple/longPress/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ export default function LongPressExample() {
1616
const colorProgress = useSharedValue(0);
1717

1818
const animatedStyle = useAnimatedStyle(() => {
19-
const backgroundColor = interpolateColor(
20-
colorProgress.value,
21-
[0, 1, 2],
22-
[COLORS.NAVY, COLORS.PURPLE, COLORS.KINDA_BLUE]
23-
);
24-
2519
return {
26-
backgroundColor,
20+
backgroundColor: interpolateColor(
21+
colorProgress.value,
22+
[0, 1, 2],
23+
[COLORS.NAVY, COLORS.PURPLE, COLORS.KINDA_BLUE]
24+
),
2725
};
2826
});
2927

apps/common-app/src/new_api/simple/pan/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ export default function PanExample() {
3232
});
3333

3434
const animatedStyle = useAnimatedStyle(() => {
35-
const backgroundColor = interpolateColor(
36-
colorProgress.value,
37-
[0, 1],
38-
[COLORS.NAVY, COLORS.KINDA_BLUE]
39-
);
4035
return {
4136
transform: [
4237
{ translateX: translateX.value },
4338
{ translateY: translateY.value },
4439
],
45-
backgroundColor,
40+
backgroundColor: interpolateColor(
41+
colorProgress.value,
42+
[0, 1],
43+
[COLORS.NAVY, COLORS.KINDA_BLUE]
44+
),
4645
};
4746
});
4847

apps/common-app/src/new_api/simple/pinch/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ export default function PinchExample() {
2626
});
2727

2828
const animatedStyle = useAnimatedStyle(() => {
29-
const backgroundColor = interpolateColor(
30-
colorProgress.value,
31-
[0, 1],
32-
[COLORS.NAVY, COLORS.KINDA_BLUE]
33-
);
34-
3529
return {
3630
transform: [{ scale: scale.value }],
37-
backgroundColor,
31+
backgroundColor: interpolateColor(
32+
colorProgress.value,
33+
[0, 1],
34+
[COLORS.NAVY, COLORS.KINDA_BLUE]
35+
),
3836
};
3937
});
4038

apps/common-app/src/new_api/simple/rotation/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ export default function RotationExample() {
2929
});
3030

3131
const animatedStyle = useAnimatedStyle(() => {
32-
const backgroundColor = interpolateColor(
33-
colorProgress.value,
34-
[0, 1],
35-
[COLORS.NAVY, COLORS.KINDA_BLUE]
36-
);
37-
3832
return {
3933
transform: [{ rotateZ: `${rotation.value}rad` }],
40-
backgroundColor,
34+
backgroundColor: interpolateColor(
35+
colorProgress.value,
36+
[0, 1],
37+
[COLORS.NAVY, COLORS.KINDA_BLUE]
38+
),
4139
};
4240
});
4341

apps/common-app/src/new_api/simple/tap/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ export default function TapExample() {
1313
const colorProgress = useSharedValue(0);
1414

1515
const animatedStyle = useAnimatedStyle(() => {
16-
const backgroundColor = interpolateColor(
17-
colorProgress.value,
18-
[0, 1],
19-
[COLORS.NAVY, COLORS.KINDA_BLUE]
20-
);
2116
return {
22-
backgroundColor,
17+
backgroundColor: interpolateColor(
18+
colorProgress.value,
19+
[0, 1],
20+
[COLORS.NAVY, COLORS.KINDA_BLUE]
21+
),
2322
};
2423
});
2524

0 commit comments

Comments
 (0)