Skip to content

Commit 4eb0d28

Browse files
committed
chore: sync with rainbow
1 parent 52c8b2f commit 4eb0d28

File tree

7 files changed

+205
-192
lines changed

7 files changed

+205
-192
lines changed

src/charts/linear/ChartDot.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
import React, { useContext } from 'react';
2-
// eslint-disable-next-line import/no-unresolved
3-
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
2+
import Animated from 'react-native-reanimated';
43
import ChartContext from '../../helpers/ChartContext';
54
import withReanimatedFallback from '../../helpers/withReanimatedFallback';
65

76
function ChartDot({ style, size = 10, ...props }) {
8-
const { dotScale, positionX, positionY } = useContext(ChartContext);
9-
const dotStyle = useAnimatedStyle(
10-
() => ({
11-
opacity: dotScale.value,
12-
transform: [
13-
{ translateX: positionX.value },
14-
{ translateY: positionY.value + 10 }, // TODO temporary fix for clipped chart
15-
{ scale: dotScale.value },
16-
],
17-
}),
18-
undefined,
19-
'dotStyle'
20-
);
7+
const { dotStyle } = useContext(ChartContext);
218

229
return (
2310
<Animated.View

src/charts/linear/ChartLabels.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { TextInput } from 'react-native';
33
import Animated, {
44
useAnimatedStyle,
55
useDerivedValue,
6-
// eslint-disable-next-line import/no-unresolved
76
} from 'react-native-reanimated';
87
import ChartContext from '../../helpers/ChartContext';
98

@@ -12,22 +11,14 @@ const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
1211
function ChartLabelFactory(style) {
1312
return function ChartLabel({ format, ...props }) {
1413
const { [style]: val = 0 } = useContext(ChartContext);
15-
const formattedValue = useDerivedValue(
16-
() => {
17-
return format ? format(val.value) : val.value;
18-
},
19-
undefined,
20-
style + 'formattedValue'
21-
);
22-
const textProps = useAnimatedStyle(
23-
() => {
24-
return {
25-
text: formattedValue.value,
26-
};
27-
},
28-
undefined,
29-
style + 'textProps'
30-
);
14+
const formattedValue = useDerivedValue(() => {
15+
return format ? format(val.value) : val.value;
16+
}, []);
17+
const textProps = useAnimatedStyle(() => {
18+
return {
19+
text: formattedValue.value,
20+
};
21+
}, []);
3122
return (
3223
<AnimatedTextInput
3324
{...props}

0 commit comments

Comments
 (0)