react-native-wagmi-charts 2.8.0 → 2.8.2
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/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import type { TCandle } from '../types';
|
|
|
2
2
|
|
|
3
3
|
export function getDomain(rows: TCandle[]): [min: number, max: number] {
|
|
4
4
|
'worklet';
|
|
5
|
+
if (rows.length === 0) return [0, 0];
|
|
5
6
|
const values = rows.map(({ high, low }) => [high, low]).flat();
|
|
6
7
|
const min = Math.min(...values);
|
|
7
8
|
const max = Math.max(...values);
|
|
@@ -20,12 +20,12 @@ export const LineChartDimensionsContext = React.createContext({
|
|
|
20
20
|
pathWidth: 0,
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
type LineChartProps = ViewProps & {
|
|
23
|
+
export type LineChartProps = ViewProps & {
|
|
24
24
|
children: React.ReactNode;
|
|
25
25
|
yGutter?: number;
|
|
26
26
|
width?: number;
|
|
27
27
|
height?: number;
|
|
28
|
-
shape?:
|
|
28
|
+
shape?: d3Shape.CurveFactory;
|
|
29
29
|
/**
|
|
30
30
|
* If your `LineChart.Provider` uses a dictionary with multiple IDs for multiple paths, then this field is required.
|
|
31
31
|
*/
|
|
@@ -110,7 +110,7 @@ export function LineChart({
|
|
|
110
110
|
width,
|
|
111
111
|
height,
|
|
112
112
|
pathWidth,
|
|
113
|
-
shape
|
|
113
|
+
shape
|
|
114
114
|
}),
|
|
115
115
|
[
|
|
116
116
|
yGutter,
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode, Children, cloneElement } from 'react';
|
|
|
2
2
|
import { ViewProps, View } from 'react-native';
|
|
3
3
|
import flattenChildren from 'react-keyed-flatten-children';
|
|
4
4
|
|
|
5
|
-
import { LineChart } from './Chart';
|
|
5
|
+
import { LineChart, LineChartProps } from './Chart';
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
children: ReactNode;
|
|
@@ -13,13 +13,16 @@ export function LineChartGroup({ children, ...props }: Props) {
|
|
|
13
13
|
const flatChildrenCount = Children.count(flatChildren);
|
|
14
14
|
return (
|
|
15
15
|
<View {...props}>
|
|
16
|
-
{
|
|
17
|
-
{Children.map(flatChildren, (child: any, index) => {
|
|
16
|
+
{Children.map(flatChildren, (child, index) => {
|
|
18
17
|
const isLast = index === flatChildrenCount - 1;
|
|
19
|
-
if (
|
|
18
|
+
if (
|
|
19
|
+
!isLast &&
|
|
20
|
+
React.isValidElement(child) &&
|
|
21
|
+
child.type === LineChart
|
|
22
|
+
) {
|
|
20
23
|
return cloneElement(child, {
|
|
21
24
|
absolute: true,
|
|
22
|
-
});
|
|
25
|
+
} as Partial<LineChartProps>);
|
|
23
26
|
}
|
|
24
27
|
return child;
|
|
25
28
|
})}
|
|
@@ -240,16 +240,16 @@ export function LineChartTooltip({
|
|
|
240
240
|
};
|
|
241
241
|
}, [
|
|
242
242
|
atXPosition,
|
|
243
|
-
atYPosition
|
|
243
|
+
atYPosition,
|
|
244
244
|
calculateXTranslateOffset,
|
|
245
245
|
calculateYTranslateOffset,
|
|
246
|
-
currentX
|
|
247
|
-
currentY
|
|
246
|
+
currentX,
|
|
247
|
+
currentY,
|
|
248
248
|
cursorGutter,
|
|
249
|
-
elementHeight
|
|
250
|
-
elementWidth
|
|
249
|
+
elementHeight,
|
|
250
|
+
elementWidth,
|
|
251
251
|
height,
|
|
252
|
-
isActive
|
|
252
|
+
isActive,
|
|
253
253
|
position,
|
|
254
254
|
type,
|
|
255
255
|
width,
|
|
@@ -2,6 +2,7 @@ import type { TLineChartPoint } from '../types';
|
|
|
2
2
|
|
|
3
3
|
export function getDomain(rows: TLineChartPoint[]): [number, number] {
|
|
4
4
|
'worklet';
|
|
5
|
+
if (rows.length === 0) return [0, 0];
|
|
5
6
|
const values = rows.map(({ value }) => value);
|
|
6
7
|
return [Math.min(...values), Math.max(...values)];
|
|
7
8
|
}
|