react-native-wagmi-charts 1.8.0 → 2.0.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/.DS_Store +0 -0
- package/README.md +331 -196
- package/example/.DS_Store +0 -0
- package/example/src/LineChart.tsx +10 -4
- package/example/src/data/line-data.json +20 -20
- package/lib/commonjs/charts/candle/utils/getDomain.js +19 -0
- package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/getHeight.js +19 -0
- package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/getPrice.js +20 -0
- package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/getY.js +19 -0
- package/lib/commonjs/charts/candle/utils/getY.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/index.js +58 -0
- package/lib/commonjs/charts/candle/utils/index.js.map +1 -0
- package/lib/commonjs/charts/line/Chart.js +9 -3
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +73 -17
- package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
- package/lib/commonjs/charts/line/Context.js +1 -0
- package/lib/commonjs/charts/line/Context.js.map +1 -1
- package/lib/commonjs/charts/line/Cursor.js +1 -0
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +10 -3
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +6 -6
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/DatetimeText.js +2 -0
- package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/line/Dot.js +67 -62
- package/lib/commonjs/charts/line/Dot.js.map +1 -1
- package/lib/commonjs/charts/line/Gradient.js +8 -25
- package/lib/commonjs/charts/line/Gradient.js.map +1 -1
- package/lib/commonjs/charts/line/Group.js +5 -25
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +92 -0
- package/lib/commonjs/charts/line/Highlight.js.map +1 -0
- package/lib/commonjs/charts/line/HorizontalLine.js +6 -6
- package/lib/commonjs/charts/line/HorizontalLine.js.map +1 -1
- package/lib/commonjs/charts/line/Path.js +19 -30
- package/lib/commonjs/charts/line/Path.js.map +1 -1
- package/lib/commonjs/charts/line/PriceText.js +2 -0
- package/lib/commonjs/charts/line/PriceText.js.map +1 -1
- package/lib/commonjs/charts/line/Tooltip.js +2 -0
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js +47 -20
- package/lib/commonjs/charts/line/index.js.map +1 -1
- package/lib/commonjs/charts/line/useAnimatedPath.js +44 -0
- package/lib/commonjs/charts/line/useAnimatedPath.js.map +1 -0
- package/lib/commonjs/charts/line/{utils.js → utils/getArea.js} +2 -49
- package/lib/commonjs/charts/line/utils/getArea.js.map +1 -0
- package/lib/commonjs/charts/line/utils/getDomain.js +16 -0
- package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -0
- package/lib/commonjs/charts/line/utils/getPath.js +34 -0
- package/lib/commonjs/charts/line/utils/getPath.js.map +1 -0
- package/lib/commonjs/charts/line/utils/index.js +71 -0
- package/lib/commonjs/charts/line/utils/index.js.map +1 -0
- package/lib/commonjs/charts/line/{interpolatePath.js → utils/interpolatePath.js} +1 -1
- package/lib/commonjs/charts/line/{interpolatePath.js.map → utils/interpolatePath.js.map} +1 -1
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +27 -0
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js.map +1 -0
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/formatDatetime.js +21 -0
- package/lib/commonjs/utils/formatDatetime.js.map +1 -0
- package/lib/commonjs/utils/formatPrice.js +46 -0
- package/lib/commonjs/utils/formatPrice.js.map +1 -0
- package/lib/commonjs/utils/index.js +45 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/{utils.js → utils/usePrevious.js} +1 -57
- package/lib/commonjs/utils/usePrevious.js.map +1 -0
- package/lib/module/charts/candle/utils/getDomain.js +12 -0
- package/lib/module/charts/candle/utils/getDomain.js.map +1 -0
- package/lib/module/charts/candle/utils/getHeight.js +11 -0
- package/lib/module/charts/candle/utils/getHeight.js.map +1 -0
- package/lib/module/charts/candle/utils/getPrice.js +12 -0
- package/lib/module/charts/candle/utils/getPrice.js.map +1 -0
- package/lib/module/charts/candle/utils/getY.js +11 -0
- package/lib/module/charts/candle/utils/getY.js.map +1 -0
- package/lib/module/charts/candle/utils/index.js +5 -0
- package/lib/module/charts/candle/utils/index.js.map +1 -0
- package/lib/module/charts/line/Chart.js +9 -4
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +69 -17
- package/lib/module/charts/line/ChartPath.js.map +1 -1
- package/lib/module/charts/line/Context.js +1 -0
- package/lib/module/charts/line/Context.js.map +1 -1
- package/lib/module/charts/line/Cursor.js +1 -0
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +10 -4
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +4 -3
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/DatetimeText.js +1 -0
- package/lib/module/charts/line/DatetimeText.js.map +1 -1
- package/lib/module/charts/line/Dot.js +66 -63
- package/lib/module/charts/line/Dot.js.map +1 -1
- package/lib/module/charts/line/Gradient.js +8 -24
- package/lib/module/charts/line/Gradient.js.map +1 -1
- package/lib/module/charts/line/Group.js +2 -24
- package/lib/module/charts/line/Group.js.map +1 -1
- package/lib/module/charts/line/Highlight.js +69 -0
- package/lib/module/charts/line/Highlight.js.map +1 -0
- package/lib/module/charts/line/HorizontalLine.js +4 -3
- package/lib/module/charts/line/HorizontalLine.js.map +1 -1
- package/lib/module/charts/line/Path.js +17 -29
- package/lib/module/charts/line/Path.js.map +1 -1
- package/lib/module/charts/line/PriceText.js +1 -0
- package/lib/module/charts/line/PriceText.js.map +1 -1
- package/lib/module/charts/line/Tooltip.js +1 -0
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js +12 -8
- package/lib/module/charts/line/index.js.map +1 -1
- package/lib/module/charts/line/useAnimatedPath.js +34 -0
- package/lib/module/charts/line/useAnimatedPath.js.map +1 -0
- package/lib/module/charts/line/utils/getArea.js +19 -0
- package/lib/module/charts/line/utils/getArea.js.map +1 -0
- package/lib/module/charts/line/utils/getDomain.js +9 -0
- package/lib/module/charts/line/utils/getDomain.js.map +1 -0
- package/lib/module/charts/line/utils/getPath.js +21 -0
- package/lib/module/charts/line/utils/getPath.js.map +1 -0
- package/lib/module/charts/line/utils/index.js +6 -0
- package/lib/module/charts/line/utils/index.js.map +1 -0
- package/lib/module/charts/line/{interpolatePath.js → utils/interpolatePath.js} +1 -1
- package/lib/module/charts/line/{interpolatePath.js.map → utils/interpolatePath.js.map} +1 -1
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js +20 -0
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/formatDatetime.js +14 -0
- package/lib/module/utils/formatDatetime.js.map +1 -0
- package/lib/module/{utils.js → utils/formatPrice.js} +1 -29
- package/lib/module/utils/formatPrice.js.map +1 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/usePrevious.js +14 -0
- package/lib/module/utils/usePrevious.js.map +1 -0
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +2 -0
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +6 -0
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +6 -0
- package/lib/typescript/src/charts/candle/utils/getY.d.ts +6 -0
- package/lib/typescript/src/charts/candle/utils/index.d.ts +4 -0
- package/lib/typescript/src/charts/line/Chart.d.ts +5 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts +10 -1
- package/lib/typescript/src/charts/line/Context.d.ts +3 -0
- package/lib/typescript/src/charts/line/Cursor.d.ts +3 -0
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +4 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts +4 -1
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +3 -0
- package/lib/typescript/src/charts/line/Dot.d.ts +10 -7
- package/lib/typescript/src/charts/line/Gradient.d.ts +3 -0
- package/lib/typescript/src/charts/line/Group.d.ts +1 -2
- package/lib/typescript/src/charts/line/Highlight.d.ts +15 -0
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +4 -1
- package/lib/typescript/src/charts/line/Path.d.ts +5 -1
- package/lib/typescript/src/charts/line/PriceText.d.ts +3 -0
- package/lib/typescript/src/charts/line/Tooltip.d.ts +3 -0
- package/lib/typescript/src/charts/line/index.d.ts +15 -25
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +8 -0
- package/lib/typescript/src/charts/line/utils/getArea.d.ts +9 -0
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts +2 -0
- package/lib/typescript/src/charts/line/utils/getPath.d.ts +11 -0
- package/lib/typescript/src/charts/line/utils/index.d.ts +5 -0
- package/lib/typescript/src/charts/line/{interpolatePath.d.ts → utils/interpolatePath.d.ts} +1 -1
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/utils/formatDatetime.d.ts +8 -0
- package/lib/typescript/src/utils/formatPrice.d.ts +8 -0
- package/lib/typescript/src/utils/index.d.ts +3 -0
- package/lib/typescript/src/utils/usePrevious.d.ts +1 -0
- package/package.json +4 -2
- package/src/charts/candle/utils/getDomain.ts +9 -0
- package/src/charts/candle/utils/getHeight.ts +21 -0
- package/src/charts/candle/utils/getPrice.ts +17 -0
- package/src/charts/candle/utils/getY.ts +16 -0
- package/src/charts/candle/utils/index.ts +4 -0
- package/src/charts/line/Chart.tsx +9 -3
- package/src/charts/line/ChartPath.tsx +109 -33
- package/src/charts/line/Context.tsx +2 -0
- package/src/charts/line/Cursor.tsx +2 -0
- package/src/charts/line/CursorCrosshair.tsx +20 -5
- package/src/charts/line/CursorLine.tsx +5 -3
- package/src/charts/line/DatetimeText.tsx +2 -0
- package/src/charts/line/Dot.tsx +83 -86
- package/src/charts/line/Gradient.tsx +7 -34
- package/src/charts/line/Group.tsx +4 -47
- package/src/charts/line/Highlight.tsx +78 -0
- package/src/charts/line/HorizontalLine.tsx +5 -3
- package/src/charts/line/Path.tsx +14 -38
- package/src/charts/line/PriceText.tsx +2 -0
- package/src/charts/line/Tooltip.tsx +2 -0
- package/src/charts/line/index.ts +11 -7
- package/src/charts/line/useAnimatedPath.ts +47 -0
- package/src/charts/line/utils/getArea.ts +38 -0
- package/src/charts/line/utils/getDomain.ts +7 -0
- package/src/charts/line/utils/getPath.ts +48 -0
- package/src/charts/line/utils/index.ts +5 -0
- package/src/charts/line/{interpolatePath.ts → utils/interpolatePath.ts} +1 -1
- package/src/charts/line/utils/lineChartDataPropToArray.ts +25 -0
- package/src/index.ts +1 -1
- package/src/utils/formatDatetime.ts +16 -0
- package/src/{utils.ts → utils/formatPrice.ts} +0 -31
- package/src/utils/index.ts +3 -0
- package/src/utils/usePrevious.ts +13 -0
- package/yarn.lock +8 -1
- package/lib/commonjs/charts/line/utils.js.map +0 -1
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/charts/line/utils.js +0 -60
- package/lib/module/charts/line/utils.js.map +0 -1
- package/lib/module/utils.js.map +0 -1
- package/lib/typescript/src/charts/line/utils.d.ts +0 -20
- package/lib/typescript/src/utils.d.ts +0 -17
- package/src/charts/line/utils.ts +0 -100
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getDomain(rows) {
|
|
2
|
+
'worklet';
|
|
3
|
+
|
|
4
|
+
const values = rows.map(({
|
|
5
|
+
high,
|
|
6
|
+
low
|
|
7
|
+
}) => [high, low]).flat();
|
|
8
|
+
const min = Math.min(...values);
|
|
9
|
+
const max = Math.max(...values);
|
|
10
|
+
return [min - (max - min) * 0.025, max + (max - min) * 0.025];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=getDomain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getDomain.ts"],"names":["getDomain","rows","values","map","high","low","flat","min","Math","max"],"mappings":"AAEA,OAAO,SAASA,SAAT,CAAmBC,IAAnB,EAAgE;AACrE;;AACA,QAAMC,MAAM,GAAGD,IAAI,CAACE,GAAL,CAAS,CAAC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAD,KAAmB,CAACD,IAAD,EAAOC,GAAP,CAA5B,EAAyCC,IAAzC,EAAf;AACA,QAAMC,GAAG,GAAGC,IAAI,CAACD,GAAL,CAAS,GAAGL,MAAZ,CAAZ;AACA,QAAMO,GAAG,GAAGD,IAAI,CAACC,GAAL,CAAS,GAAGP,MAAZ,CAAZ;AACA,SAAO,CAACK,GAAG,GAAG,CAACE,GAAG,GAAGF,GAAP,IAAc,KAArB,EAA4BE,GAAG,GAAG,CAACA,GAAG,GAAGF,GAAP,IAAc,KAAhD,CAAP;AACD","sourcesContent":["import type { TCandle } from '../types';\n\nexport function getDomain(rows: TCandle[]): [min: number, max: number] {\n 'worklet';\n const values = rows.map(({ high, low }) => [high, low]).flat();\n const min = Math.min(...values);\n const max = Math.max(...values);\n return [min - (max - min) * 0.025, max + (max - min) * 0.025];\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { interpolate, Extrapolate } from 'react-native-reanimated';
|
|
2
|
+
export function getHeight({
|
|
3
|
+
value,
|
|
4
|
+
domain,
|
|
5
|
+
maxHeight
|
|
6
|
+
}) {
|
|
7
|
+
'worklet';
|
|
8
|
+
|
|
9
|
+
return interpolate(value, [0, Math.max(...domain) - Math.min(...domain)], [0, maxHeight], Extrapolate.CLAMP);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=getHeight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getHeight.ts"],"names":["interpolate","Extrapolate","getHeight","value","domain","maxHeight","Math","max","min","CLAMP"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,yBAAzC;AAIA,OAAO,SAASC,SAAT,CAAmB;AACxBC,EAAAA,KADwB;AAExBC,EAAAA,MAFwB;AAGxBC,EAAAA;AAHwB,CAAnB,EAQJ;AACD;;AACA,SAAOL,WAAW,CAChBG,KADgB,EAEhB,CAAC,CAAD,EAAIG,IAAI,CAACC,GAAL,CAAS,GAAGH,MAAZ,IAAsBE,IAAI,CAACE,GAAL,CAAS,GAAGJ,MAAZ,CAA1B,CAFgB,EAGhB,CAAC,CAAD,EAAIC,SAAJ,CAHgB,EAIhBJ,WAAW,CAACQ,KAJI,CAAlB;AAMD","sourcesContent":["import { interpolate, Extrapolate } from 'react-native-reanimated';\n\nimport type { TDomain } from '../types';\n\nexport function getHeight({\n value,\n domain,\n maxHeight,\n}: {\n value: number;\n domain: TDomain;\n maxHeight: number;\n}) {\n 'worklet';\n return interpolate(\n value,\n [0, Math.max(...domain) - Math.min(...domain)],\n [0, maxHeight],\n Extrapolate.CLAMP\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { interpolate, Extrapolate } from 'react-native-reanimated';
|
|
2
|
+
export function getPrice({
|
|
3
|
+
y,
|
|
4
|
+
domain,
|
|
5
|
+
maxHeight
|
|
6
|
+
}) {
|
|
7
|
+
'worklet';
|
|
8
|
+
|
|
9
|
+
if (y === -1) return -1;
|
|
10
|
+
return interpolate(y, [0, maxHeight], domain.reverse(), Extrapolate.CLAMP);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=getPrice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getPrice.ts"],"names":["interpolate","Extrapolate","getPrice","y","domain","maxHeight","reverse","CLAMP"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,yBAAzC;AAIA,OAAO,SAASC,QAAT,CAAkB;AACvBC,EAAAA,CADuB;AAEvBC,EAAAA,MAFuB;AAGvBC,EAAAA;AAHuB,CAAlB,EAQJ;AACD;;AACA,MAAIF,CAAC,KAAK,CAAC,CAAX,EAAc,OAAO,CAAC,CAAR;AACd,SAAOH,WAAW,CAACG,CAAD,EAAI,CAAC,CAAD,EAAIE,SAAJ,CAAJ,EAAoBD,MAAM,CAACE,OAAP,EAApB,EAAsCL,WAAW,CAACM,KAAlD,CAAlB;AACD","sourcesContent":["import { interpolate, Extrapolate } from 'react-native-reanimated';\n\nimport type { TDomain } from '../types';\n\nexport function getPrice({\n y,\n domain,\n maxHeight,\n}: {\n y: number;\n domain: TDomain;\n maxHeight: number;\n}) {\n 'worklet';\n if (y === -1) return -1;\n return interpolate(y, [0, maxHeight], domain.reverse(), Extrapolate.CLAMP);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getY.ts"],"names":["interpolate","Extrapolate","getY","value","domain","maxHeight","CLAMP"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,yBAAzC;AAIA,OAAO,SAASC,IAAT,CAAc;AACnBC,EAAAA,KADmB;AAEnBC,EAAAA,MAFmB;AAGnBC,EAAAA;AAHmB,CAAd,EAQJ;AACD;;AACA,SAAOL,WAAW,CAACG,KAAD,EAAQC,MAAR,EAAgB,CAACC,SAAD,EAAY,CAAZ,CAAhB,EAAgCJ,WAAW,CAACK,KAA5C,CAAlB;AACD","sourcesContent":["import { interpolate, Extrapolate } from 'react-native-reanimated';\n\nimport type { TDomain } from '../types';\n\nexport function getY({\n value,\n domain,\n maxHeight,\n}: {\n value: number;\n domain: TDomain;\n maxHeight: number;\n}) {\n 'worklet';\n return interpolate(value, domain, [maxHeight, 0], Extrapolate.CLAMP);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAd;AACA,cAAc,aAAd;AACA,cAAc,YAAd;AACA,cAAc,QAAd","sourcesContent":["export * from './getDomain';\nexport * from './getHeight';\nexport * from './getPrice';\nexport * from './getY';\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
3
|
+
import * as React from 'react'; // @ts-ignore
|
|
4
|
+
|
|
5
|
+
import * as d3Shape from 'd3-shape';
|
|
4
6
|
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
5
7
|
import { LineChartContext } from './Context';
|
|
6
8
|
import { LineChartIdProvider, useLineChartData } from './Data';
|
|
@@ -10,18 +12,20 @@ export const LineChartDimensionsContext = /*#__PURE__*/React.createContext({
|
|
|
10
12
|
height: 0,
|
|
11
13
|
path: '',
|
|
12
14
|
area: '',
|
|
15
|
+
shape: d3Shape.curveBumpX,
|
|
13
16
|
gutter: 0,
|
|
14
17
|
pathWidth: 0
|
|
15
18
|
});
|
|
16
19
|
const {
|
|
17
20
|
width: screenWidth
|
|
18
21
|
} = Dimensions.get('window');
|
|
22
|
+
LineChart.displayName = 'LineChart';
|
|
19
23
|
export function LineChart({
|
|
20
24
|
children,
|
|
21
25
|
yGutter = 16,
|
|
22
26
|
width = screenWidth,
|
|
23
27
|
height = screenWidth,
|
|
24
|
-
shape,
|
|
28
|
+
shape = d3Shape.curveBumpX,
|
|
25
29
|
id,
|
|
26
30
|
absolute,
|
|
27
31
|
...props
|
|
@@ -78,8 +82,9 @@ export function LineChart({
|
|
|
78
82
|
path,
|
|
79
83
|
width,
|
|
80
84
|
height,
|
|
81
|
-
pathWidth
|
|
82
|
-
|
|
85
|
+
pathWidth,
|
|
86
|
+
shape
|
|
87
|
+
}), [yGutter, area, path, width, height, pathWidth, shape]);
|
|
83
88
|
return /*#__PURE__*/React.createElement(LineChartIdProvider, {
|
|
84
89
|
id: id
|
|
85
90
|
}, /*#__PURE__*/React.createElement(LineChartDimensionsContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Chart.tsx"],"names":["React","Dimensions","StyleSheet","View","LineChartContext","LineChartIdProvider","useLineChartData","getArea","getPath","LineChartDimensionsContext","createContext","width","height","path","area","gutter","pathWidth","screenWidth","get","LineChart","
|
|
1
|
+
{"version":3,"sources":["Chart.tsx"],"names":["React","d3Shape","Dimensions","StyleSheet","View","LineChartContext","LineChartIdProvider","useLineChartData","getArea","getPath","LineChartDimensionsContext","createContext","width","height","path","area","shape","curveBumpX","gutter","pathWidth","screenWidth","get","LineChart","displayName","children","yGutter","id","absolute","props","yDomain","xLength","useContext","data","useMemo","allowedWidth","length","contextValue","styles","style","create","position"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB,C,CACA;;AACA,OAAO,KAAKC,OAAZ,MAAyB,UAAzB;AACA,SAASC,UAAT,EAAqBC,UAArB,EAAiCC,IAAjC,QAAwD,cAAxD;AACA,SAASC,gBAAT,QAAiC,WAAjC;AACA,SAASC,mBAAT,EAA8BC,gBAA9B,QAAsD,QAAtD;AAEA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,SAAjC;AAEA,OAAO,MAAMC,0BAA0B,gBAAGV,KAAK,CAACW,aAAN,CAAoB;AAC5DC,EAAAA,KAAK,EAAE,CADqD;AAE5DC,EAAAA,MAAM,EAAE,CAFoD;AAG5DC,EAAAA,IAAI,EAAE,EAHsD;AAI5DC,EAAAA,IAA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5C,kBACE,oBAAC,IAAD,eAAUR,KAAV;AAAiB,IAAA,KAAK,EAAE,CAACD,QAAQ,IAAIU,MAAM,CAACV,QAApB,EAA8BC,KAAK,CAACU,KAApC;AAAxB,MACGd,QADH,CADF,CADF,CADF;AASD;AAED,MAAMa,MAAM,GAAGlC,UAAU,CAACoC,MAAX,CAAkB;AAC/BZ,EAAAA,QAAQ,EAAE;AACRa,IAAAA,QAAQ,EAAE;AADF;AADqB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\n// @ts-ignore\nimport * as d3Shape from 'd3-shape';\nimport { Dimensions, StyleSheet, View, ViewProps } from 'react-native';\nimport { LineChartContext } from './Context';\nimport { LineChartIdProvider, useLineChartData } from './Data';\n\nimport { getArea, getPath } from './utils';\n\nexport const LineChartDimensionsContext = React.createContext({\n width: 0,\n height: 0,\n path: '',\n area: '',\n shape: d3Shape.curveBumpX,\n gutter: 0,\n pathWidth: 0,\n});\n\ntype LineChartProps = ViewProps & {\n children: React.ReactNode;\n yGutter?: number;\n width?: number;\n height?: number;\n shape?: unknown;\n /**\n * If your `LineChart.Provider` uses a dictionary with multiple IDs for multiple paths, then this field is required.\n */\n id?: string;\n absolute?: boolean;\n};\n\nconst { width: screenWidth } = Dimensions.get('window');\n\nLineChart.displayName = 'LineChart';\n\nexport function LineChart({\n children,\n yGutter = 16,\n width = screenWidth,\n height = screenWidth,\n shape = d3Shape.curveBumpX,\n id,\n absolute,\n ...props\n}: LineChartProps) {\n const { yDomain, xLength } = React.useContext(LineChartContext);\n const { data } = useLineChartData({\n id,\n });\n\n const pathWidth = React.useMemo(() => {\n let allowedWidth = width;\n if (xLength > data.length) {\n allowedWidth = (width * data.length) / xLength;\n }\n return allowedWidth;\n }, [data.length, width, xLength]);\n\n const path = React.useMemo(() => {\n if (data && data.length > 0) {\n return getPath({\n data,\n width: pathWidth,\n height,\n gutter: yGutter,\n shape,\n yDomain,\n });\n }\n return '';\n }, [data, pathWidth, height, yGutter, shape, yDomain]);\n\n const area = React.useMemo(() => {\n if (data && data.length > 0) {\n return getArea({\n data,\n width: pathWidth,\n height,\n gutter: yGutter,\n shape,\n yDomain,\n });\n }\n return '';\n }, [data, pathWidth, height, yGutter, shape, yDomain]);\n\n const contextValue = React.useMemo(\n () => ({\n gutter: yGutter,\n area,\n path,\n width,\n height,\n pathWidth,\n shape,\n }),\n [yGutter, area, path, width, height, pathWidth, shape]\n );\n\n return (\n <LineChartIdProvider id={id}>\n <LineChartDimensionsContext.Provider value={contextValue}>\n <View {...props} style={[absolute && styles.absolute, props.style]}>\n {children}\n </View>\n </LineChartDimensionsContext.Provider>\n </LineChartIdProvider>\n );\n}\n\nconst styles = StyleSheet.create({\n absolute: {\n position: 'absolute',\n },\n});\n"]}
|
|
@@ -3,25 +3,35 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { StyleSheet, View } from 'react-native';
|
|
5
5
|
import { Svg } from 'react-native-svg';
|
|
6
|
-
import Animated, { useAnimatedProps, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import Animated, { useAnimatedProps, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
7
|
+
import flattenChildren from 'react-keyed-flatten-children';
|
|
7
8
|
import { LineChartDimensionsContext } from './Chart';
|
|
8
9
|
import { LineChartPath } from './Path';
|
|
9
10
|
import { useLineChart } from './useLineChart';
|
|
11
|
+
const BACKGROUND_COMPONENTS = ['LineChartHighlight', 'LineChartHorizontalLine', 'LineChartGradient', 'LineChartDot'];
|
|
12
|
+
const FOREGROUND_COMPONENTS = ['LineChartHighlight', 'LineChartDot'];
|
|
10
13
|
const AnimatedSVG = Animated.createAnimatedComponent(Svg);
|
|
11
14
|
export const LineChartPathContext = /*#__PURE__*/React.createContext({
|
|
12
15
|
color: '',
|
|
16
|
+
isInactive: false,
|
|
13
17
|
isTransitionEnabled: true
|
|
14
18
|
});
|
|
19
|
+
LineChartPathWrapper.displayName = 'LineChartPathWrapper';
|
|
15
20
|
export function LineChartPathWrapper({
|
|
16
21
|
animationDuration = 300,
|
|
17
22
|
animationProps = {},
|
|
18
23
|
children,
|
|
19
24
|
color = 'black',
|
|
25
|
+
inactiveColor,
|
|
20
26
|
width: strokeWidth = 3,
|
|
27
|
+
widthOffset = 20,
|
|
21
28
|
pathProps = {},
|
|
22
|
-
showInactivePath = true
|
|
29
|
+
showInactivePath = true,
|
|
30
|
+
animateOnMount,
|
|
31
|
+
mountAnimationDuration = animationDuration,
|
|
32
|
+
mountAnimationProps = animationProps
|
|
23
33
|
}) {
|
|
24
|
-
var _pathProps$isTransiti;
|
|
34
|
+
var _pathProps$isTransiti, _pathProps$isTransiti2;
|
|
25
35
|
|
|
26
36
|
const {
|
|
27
37
|
height,
|
|
@@ -31,23 +41,59 @@ export function LineChartPathWrapper({
|
|
|
31
41
|
const {
|
|
32
42
|
currentX,
|
|
33
43
|
isActive
|
|
34
|
-
} = useLineChart();
|
|
44
|
+
} = useLineChart();
|
|
45
|
+
const isMounted = useSharedValue(false);
|
|
46
|
+
const hasMountedAnimation = useSharedValue(false);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
isMounted.value = true; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
+
}, []); ////////////////////////////////////////////////
|
|
35
50
|
|
|
36
|
-
const svgProps = useAnimatedProps(() =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
const svgProps = useAnimatedProps(() => {
|
|
52
|
+
const shouldAnimateOnMount = animateOnMount === 'foreground';
|
|
53
|
+
const inactiveWidth = !isMounted.value && shouldAnimateOnMount ? 0 : pathWidth;
|
|
54
|
+
const duration = shouldAnimateOnMount && !hasMountedAnimation.value ? mountAnimationDuration : animationDuration;
|
|
55
|
+
const props = shouldAnimateOnMount && !hasMountedAnimation.value ? mountAnimationProps : animationProps;
|
|
56
|
+
return {
|
|
57
|
+
width: isActive.value ? // on Web, <svg /> elements don't support negative widths
|
|
58
|
+
// https://github.com/coinjar/react-native-wagmi-charts/issues/24#issuecomment-955789904
|
|
59
|
+
Math.max(currentX.value, 0) : withTiming(inactiveWidth + widthOffset, Object.assign({
|
|
60
|
+
duration
|
|
61
|
+
}, props), () => {
|
|
62
|
+
hasMountedAnimation.value = true;
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
});
|
|
43
66
|
const viewSize = React.useMemo(() => ({
|
|
44
67
|
width,
|
|
45
68
|
height
|
|
46
69
|
}), [width, height]); ////////////////////////////////////////////////
|
|
47
70
|
|
|
48
|
-
|
|
71
|
+
let backgroundChildren;
|
|
72
|
+
let foregroundChildren;
|
|
73
|
+
|
|
74
|
+
if (children) {
|
|
75
|
+
const iterableChildren = flattenChildren(children);
|
|
76
|
+
backgroundChildren = iterableChildren.filter(child => {
|
|
77
|
+
var _child$type;
|
|
78
|
+
|
|
79
|
+
return (// @ts-ignore
|
|
80
|
+
BACKGROUND_COMPONENTS.includes(child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName)
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
foregroundChildren = iterableChildren.filter(child => {
|
|
84
|
+
var _child$type2;
|
|
85
|
+
|
|
86
|
+
return (// @ts-ignore
|
|
87
|
+
FOREGROUND_COMPONENTS.includes(child === null || child === void 0 ? void 0 : (_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName)
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
} ////////////////////////////////////////////////
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LineChartPathContext.Provider, {
|
|
49
94
|
value: {
|
|
50
95
|
color,
|
|
96
|
+
isInactive: showInactivePath,
|
|
51
97
|
isTransitionEnabled: (_pathProps$isTransiti = pathProps.isTransitionEnabled) !== null && _pathProps$isTransiti !== void 0 ? _pathProps$isTransiti : true
|
|
52
98
|
}
|
|
53
99
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -55,11 +101,17 @@ export function LineChartPathWrapper({
|
|
|
55
101
|
}, /*#__PURE__*/React.createElement(Svg, {
|
|
56
102
|
width: width,
|
|
57
103
|
height: height
|
|
58
|
-
},
|
|
104
|
+
}, /*#__PURE__*/React.createElement(LineChartPath, _extends({
|
|
59
105
|
color: color,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, pathProps)))), /*#__PURE__*/React.createElement(
|
|
106
|
+
inactiveColor: inactiveColor,
|
|
107
|
+
width: strokeWidth
|
|
108
|
+
}, pathProps)), backgroundChildren))), /*#__PURE__*/React.createElement(LineChartPathContext.Provider, {
|
|
109
|
+
value: {
|
|
110
|
+
color,
|
|
111
|
+
isInactive: false,
|
|
112
|
+
isTransitionEnabled: (_pathProps$isTransiti2 = pathProps.isTransitionEnabled) !== null && _pathProps$isTransiti2 !== void 0 ? _pathProps$isTransiti2 : true
|
|
113
|
+
}
|
|
114
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
63
115
|
style: StyleSheet.absoluteFill
|
|
64
116
|
}, /*#__PURE__*/React.createElement(AnimatedSVG, {
|
|
65
117
|
animatedProps: svgProps,
|
|
@@ -67,6 +119,6 @@ export function LineChartPathWrapper({
|
|
|
67
119
|
}, /*#__PURE__*/React.createElement(LineChartPath, _extends({
|
|
68
120
|
color: color,
|
|
69
121
|
width: strokeWidth
|
|
70
|
-
}, pathProps)))));
|
|
122
|
+
}, pathProps)), foregroundChildren))));
|
|
71
123
|
}
|
|
72
124
|
//# sourceMappingURL=ChartPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ChartPath.tsx"],"names":["React","StyleSheet","View","Svg","Animated","useAnimatedProps","withTiming","LineChartDimensionsContext","LineChartPath","useLineChart","AnimatedSVG","createAnimatedComponent","LineChartPathContext","createContext","color","isTransitionEnabled","LineChartPathWrapper","animationDuration","animationProps","children","width","strokeWidth","pathProps","showInactivePath","height","pathWidth","useContext","currentX","isActive","
|
|
1
|
+
{"version":3,"sources":["ChartPath.tsx"],"names":["React","StyleSheet","View","Svg","Animated","useAnimatedProps","useSharedValue","withTiming","flattenChildren","LineChartDimensionsContext","LineChartPath","useLineChart","BACKGROUND_COMPONENTS","FOREGROUND_COMPONENTS","AnimatedSVG","createAnimatedComponent","LineChartPathContext","createContext","color","isInactive","isTransitionEnabled","LineChartPathWrapper","displayName","animationDuration","animationProps","children","inactiveColor","width","strokeWidth","widthOffset","pathProps","showInactivePath","animateOnMount","mountAnimationDuration","mountAnimationProps","height","pathWidth","useContext","currentX","isActive","isMounted","hasMountedAnimation","useEffect","value","svgProps","shouldAnimateOnMount","inactiveWidth","duration","props","Math","max","Object","assign","viewSize","useMemo","backgroundChildren","foregroundChildren","iterableChildren","filter","child","includes","type","absoluteFill"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AACA,SAASC,GAAT,QAAoB,kBAApB;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,cAFF,EAGEC,UAHF,QAIO,yBAJP;AAKA,OAAOC,eAAP,MAA4B,8BAA5B;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,aAAT,QAAkD,QAAlD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,MAAMC,qBAAqB,GAAG,CAC5B,oBAD4B,EAE5B,yBAF4B,EAG5B,mBAH4B,EAI5B,cAJ4B,CAA9B;AAMA,MAAMC,qBAAqB,GAAG,CAAC,oBAAD,EAAuB,cAAvB,CAA9B;AAEA,MAAMC,WAAW,GAAGV,QAAQ,CAACW,uBAAT,CAAiCZ,GAAjC,CAApB;AAEA,OAAO,MAAMa,oBAAoB,gBAAGhB,KAAK,CAACiB,aAAN,CAAoB;AACtDC,EAAAA,KAAK,EAAE,EAD+C;AAEtDC,EAAAA,UAAU,EAAE,KAF0C;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CAA+BA,KAAK,CAAEE,IAAtC,iDAA+B,aAAavC,WAA5C;AAF2C;AAAA,KAAxB,CAArB;AAID,GA5D2B,CA8D5B;;;AAEA,sBACE,uDACE,oBAAC,oBAAD,CAAsB,QAAtB;AACE,IAAA,KAAK,EAAE;AACLJ,MAAAA,KADK;AAELC,MAAAA,UAAU,EAAEY,gBAFP;AAGLX,MAAAA,mBAAmB,2BAAEU,SAAS,CAACV,mBAAZ,yEAAmC;AAHjD;AADT,kBAOE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEiC;AAAb,kBACE,oBAAC,GAAD;AAAK,IAAA,KAAK,EAAE1B,KAAZ;AAAmB,IAAA,MAAM,EAAEQ;AAA3B,kBACE,oBAAC,aAAD;AACE,IAAA,KAAK,EAAEjB,KADT;AAEE,IAAA,aAAa,EAAEQ,aAFjB;AAGE,IAAA,KAAK,EAAEE;AAHT,KAIME,SAJN,EADF,EAOGyB,kBAPH,CADF,CAPF,CADF,eAoBE,oBAAC,oBAAD,CAAsB,QAAtB;AACE,IAAA,KAAK,EAAE;AACLrC,MAAAA,KADK;AAELC,MAAAA,UAAU,EAAE,KAFP;AAGLC,MAAAA,mBAAmB,4BAAEU,SAAS,CAACV,mBAAZ,2EAAmC;AAHjD;AADT,kBAOE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEnB,UAAU,CAAC6D;AAAxB,kBACE,oBAAC,WAAD;AAAa,IAAA,aAAa,EAAElB,QAA5B;AAAsC,IAAA,MAAM,EAAET;AAA9C,kBACE,oBAAC,aAAD;AAAe,IAAA,KAAK,EAAEjB,KAAtB;AAA6B,IAAA,KAAK,EAAEU;AAApC,KAAqDE,SAArD,EADF,EAEG0B,kBAFH,CADF,CAPF,CApBF,CADF;AAqCD","sourcesContent":["import * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport { Svg } from 'react-native-svg';\nimport Animated, {\n useAnimatedProps,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport flattenChildren from 'react-keyed-flatten-children';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { LineChartPath, LineChartPathProps } from './Path';\nimport { useLineChart } from './useLineChart';\n\nconst BACKGROUND_COMPONENTS = [\n 'LineChartHighlight',\n 'LineChartHorizontalLine',\n 'LineChartGradient',\n 'LineChartDot',\n];\nconst FOREGROUND_COMPONENTS = ['LineChartHighlight', 'LineChartDot'];\n\nconst AnimatedSVG = Animated.createAnimatedComponent(Svg);\n\nexport const LineChartPathContext = React.createContext({\n color: '',\n isInactive: false,\n isTransitionEnabled: true,\n});\n\ntype LineChartPathWrapperProps = {\n animationDuration?: number;\n animationProps?: Partial<Animated.WithTimingConfig>;\n children?: React.ReactNode;\n color?: string;\n inactiveColor?: string;\n width?: number;\n widthOffset?: number;\n pathProps?: Partial<LineChartPathProps>;\n showInactivePath?: boolean;\n animateOnMount?: 'foreground';\n mountAnimationDuration?: number;\n mountAnimationProps?: Partial<Animated.WithTimingConfig>;\n};\n\nLineChartPathWrapper.displayName = 'LineChartPathWrapper';\n\nexport function LineChartPathWrapper({\n animationDuration = 300,\n animationProps = {},\n children,\n color = 'black',\n inactiveColor,\n width: strokeWidth = 3,\n widthOffset = 20,\n pathProps = {},\n showInactivePath = true,\n animateOnMount,\n mountAnimationDuration = animationDuration,\n mountAnimationProps = animationProps,\n}: LineChartPathWrapperProps) {\n const { height, pathWidth, width } = React.useContext(\n LineChartDimensionsContext\n );\n const { currentX, isActive } = useLineChart();\n const isMounted = useSharedValue(false);\n const hasMountedAnimation = useSharedValue(false);\n\n React.useEffect(() => {\n isMounted.value = true;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n ////////////////////////////////////////////////\n\n const svgProps = useAnimatedProps(() => {\n const shouldAnimateOnMount = animateOnMount === 'foreground';\n const inactiveWidth =\n !isMounted.value && shouldAnimateOnMount ? 0 : pathWidth;\n\n const duration =\n shouldAnimateOnMount && !hasMountedAnimation.value\n ? mountAnimationDuration\n : animationDuration;\n const props =\n shouldAnimateOnMount && !hasMountedAnimation.value\n ? mountAnimationProps\n : animationProps;\n\n return {\n width: isActive.value\n ? // on Web, <svg /> elements don't support negative widths\n // https://github.com/coinjar/react-native-wagmi-charts/issues/24#issuecomment-955789904\n Math.max(currentX.value, 0)\n : withTiming(\n inactiveWidth + widthOffset,\n Object.assign({ duration }, props),\n () => {\n hasMountedAnimation.value = true;\n }\n ),\n };\n });\n\n const viewSize = React.useMemo(() => ({ width, height }), [width, height]);\n\n ////////////////////////////////////////////////\n\n let backgroundChildren;\n let foregroundChildren;\n if (children) {\n const iterableChildren = flattenChildren(children);\n backgroundChildren = iterableChildren.filter((child) =>\n // @ts-ignore\n BACKGROUND_COMPONENTS.includes(child?.type?.displayName)\n );\n foregroundChildren = iterableChildren.filter((child) =>\n // @ts-ignore\n FOREGROUND_COMPONENTS.includes(child?.type?.displayName)\n );\n }\n\n ////////////////////////////////////////////////\n\n return (\n <>\n <LineChartPathContext.Provider\n value={{\n color,\n isInactive: showInactivePath,\n isTransitionEnabled: pathProps.isTransitionEnabled ?? true,\n }}\n >\n <View style={viewSize}>\n <Svg width={width} height={height}>\n <LineChartPath\n color={color}\n inactiveColor={inactiveColor}\n width={strokeWidth}\n {...pathProps}\n />\n {backgroundChildren}\n </Svg>\n </View>\n </LineChartPathContext.Provider>\n <LineChartPathContext.Provider\n value={{\n color,\n isInactive: false,\n isTransitionEnabled: pathProps.isTransitionEnabled ?? true,\n }}\n >\n <View style={StyleSheet.absoluteFill}>\n <AnimatedSVG animatedProps={svgProps} height={height}>\n <LineChartPath color={color} width={strokeWidth} {...pathProps} />\n {foregroundChildren}\n </AnimatedSVG>\n </View>\n </LineChartPathContext.Provider>\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Context.tsx"],"names":["React","runOnJS","useAnimatedReaction","useSharedValue","LineChartDataProvider","getDomain","lineChartDataPropToArray","LineChartContext","createContext","currentX","value","currentIndex","domain","isActive","yDomain","min","max","xLength","LineChartProvider","children","data","yRange","onCurrentIndexChange","useMemo","Array","isArray","Object","values","contextValue","map","Math","length","x","prevX"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,OADF,EAEEC,mBAFF,EAGEC,cAHF,QAIO,yBAJP;AAMA,SAASC,qBAAT,QAAsC,QAAtC;AAGA,SAASC,SAAT,EAAoBC,wBAApB,QAAoD,SAApD;AAEA,OAAO,MAAMC,gBAAgB,gBAAGP,KAAK,CAACQ,aAAN,CAAuC;AACrEC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,KAAK,EAAE,CAAC;AAAV,GAD2D;AAErEC,EAAAA,YAAY,EAAE;AAAED,IAAAA,KAAK,EAAE,CAAC;AAAV,GAFuD;AAGrEE,EAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,CAAJ,CAH6D;AAIrEC,EAAAA,QAAQ,EAAE;AAAEH,IAAAA,KAAK,EAAE;AAAT,GAJ2D;AAKrEI,EAAAA,OAAO,EAAE;AACPC,IAAAA,GAAG,EAAE,CADE;AAEPC,IAAAA,GAAG,EAAE;AAFE,GAL4D;AASrEC,EAAAA,OAAO,EAAE;AAT4D,CAAvC,CAAzB;
|
|
1
|
+
{"version":3,"sources":["Context.tsx"],"names":["React","runOnJS","useAnimatedReaction","useSharedValue","LineChartDataProvider","getDomain","lineChartDataPropToArray","LineChartContext","createContext","currentX","value","currentIndex","domain","isActive","yDomain","min","max","xLength","LineChartProvider","displayName","children","data","yRange","onCurrentIndexChange","useMemo","Array","isArray","Object","values","contextValue","map","Math","length","x","prevX"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,OADF,EAEEC,mBAFF,EAGEC,cAHF,QAIO,yBAJP;AAMA,SAASC,qBAAT,QAAsC,QAAtC;AAGA,SAASC,SAAT,EAAoBC,wBAApB,QAAoD,SAApD;AAEA,OAAO,MAAMC,gBAAgB,gBAAGP,KAAK,CAACQ,aAAN,CAAuC;AACrEC,E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Reaction,\n useSharedValue,\n} from 'react-native-reanimated';\nimport type { TLineChartDataProp } from './types';\nimport { LineChartDataProvider } from './Data';\n\nimport type { TLineChartContext, YRangeProp } from './types';\nimport { getDomain, lineChartDataPropToArray } from './utils';\n\nexport const LineChartContext = React.createContext<TLineChartContext>({\n currentX: { value: -1 },\n currentIndex: { value: -1 },\n domain: [0, 0],\n isActive: { value: false },\n yDomain: {\n min: 0,\n max: 0,\n },\n xLength: 0,\n});\n\ntype LineChartProviderProps = {\n children: React.ReactNode;\n data: TLineChartDataProp;\n yRange?: YRangeProp;\n onCurrentIndexChange?: (x: number) => void;\n xLength?: number;\n};\n\nLineChartProvider.displayName = 'LineChartProvider';\n\nexport function LineChartProvider({\n children,\n data = [],\n yRange,\n onCurrentIndexChange,\n xLength,\n}: LineChartProviderProps) {\n const currentX = useSharedValue(-1);\n const currentIndex = useSharedValue(-1);\n const isActive = useSharedValue(false);\n\n const domain = React.useMemo(\n () => getDomain(Array.isArray(data) ? data : Object.values(data)[0]),\n [data]\n );\n\n const contextValue = React.useMemo<TLineChartContext>(() => {\n const values = lineChartDataPropToArray(data).map(({ value }) => value);\n\n return {\n currentX,\n currentIndex,\n isActive,\n domain,\n yDomain: {\n min: yRange?.min ?? Math.min(...values),\n max: yRange?.max ?? Math.max(...values),\n },\n xLength:\n xLength ?? (Array.isArray(data) ? data : Object.values(data)[0]).length,\n };\n }, [\n currentIndex,\n currentX,\n data,\n domain,\n isActive,\n yRange?.max,\n yRange?.min,\n xLength,\n ]);\n\n useAnimatedReaction(\n () => currentIndex.value,\n (x, prevX) => {\n if (x !== -1 && x !== prevX && onCurrentIndexChange) {\n runOnJS(onCurrentIndexChange)(x);\n }\n }\n );\n\n return (\n <LineChartDataProvider data={data}>\n <LineChartContext.Provider value={contextValue}>\n {children}\n </LineChartContext.Provider>\n </LineChartDataProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Cursor.tsx"],"names":["React","StyleSheet","LongPressGestureHandler","Animated","useAnimatedGestureHandler","parse","LineChartDimensionsContext","useLineChart","CursorContext","createContext","type","LineChartCursor","children","props","pathWidth","width","path","useContext","currentX","currentIndex","isActive","data","parsedPath","useMemo","undefined","onGestureEvent","onActive","x","boundedX","value","minIndex","boundedIndex","Math","max","round","length","onEnd","absoluteFill"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAEEC,uBAFF,QAKO,8BALP;AAMA,OAAOC,QAAP,IAAmBC,yBAAnB,QAAoD,yBAApD;AACA,SAASC,KAAT,QAAsB,qBAAtB;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAOA,OAAO,MAAMC,aAAa,gBAAGR,KAAK,CAACS,aAAN,CAAoB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAApB,CAAtB;
|
|
1
|
+
{"version":3,"sources":["Cursor.tsx"],"names":["React","StyleSheet","LongPressGestureHandler","Animated","useAnimatedGestureHandler","parse","LineChartDimensionsContext","useLineChart","CursorContext","createContext","type","LineChartCursor","displayName","children","props","pathWidth","width","path","useContext","currentX","currentIndex","isActive","data","parsedPath","useMemo","undefined","onGestureEvent","onActive","x","boundedX","value","minIndex","boundedIndex","Math","max","round","length","onEnd","absoluteFill"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAEEC,uBAFF,QAKO,8BALP;AAMA,OAAOC,QAAP,IAAmBC,yBAAnB,QAAoD,yBAApD;AACA,SAASC,KAAT,QAAsB,qBAAtB;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAOA,OAAO,MAAMC,aAAa,gBAAGR,KAAK,CAACS,aAAN,CAAoB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAApB,CAAtB;AAEPC,eAAe,CAACC,WAAh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AACU,KAAb,GAAqB,CAAC,CAAtB;AACD;AAtBD,GAF8C,CAAhD;AA2BA,sBACE,oBAAC,aAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAE;AAAEpB,MAAAA;AAAF;AAA/B,kBACE,oBAAC,uBAAD;AACE,IAAA,aAAa,EAAE,CADjB;AAEE,IAAA,OAAO,EAAE,MAFX;AAGE,IAAA,cAAc,EAAEgB;AAHlB,KAIMZ,KAJN,gBAME,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEb,UAAU,CAACqC;AAAjC,KACGzB,QADH,CANF,CADF,CADF;AAcD","sourcesContent":["import * as React from 'react';\nimport { StyleSheet } from 'react-native';\nimport {\n GestureEvent,\n LongPressGestureHandler,\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from 'react-native-gesture-handler';\nimport Animated, { useAnimatedGestureHandler } from 'react-native-reanimated';\nimport { parse } from 'react-native-redash';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { useLineChart } from './useLineChart';\n\nexport type LineChartCursorProps = LongPressGestureHandlerProps & {\n children: React.ReactNode;\n type: 'line' | 'crosshair';\n};\n\nexport const CursorContext = React.createContext({ type: '' });\n\nLineChartCursor.displayName = 'LineChartCursor';\n\nexport function LineChartCursor({\n children,\n type,\n ...props\n}: LineChartCursorProps) {\n const { pathWidth: width, path } = React.useContext(\n LineChartDimensionsContext\n );\n const { currentX, currentIndex, isActive, data } = useLineChart();\n\n const parsedPath = React.useMemo(\n () => (path ? parse(path) : undefined),\n [path]\n );\n\n const onGestureEvent = useAnimatedGestureHandler<\n GestureEvent<LongPressGestureHandlerEventPayload>\n >({\n onActive: ({ x }) => {\n if (parsedPath) {\n const boundedX = x <= width ? x : width;\n isActive.value = true;\n currentX.value = boundedX;\n\n // on Web, we could drag the cursor to be negative, breaking it\n // so we clamp the index at 0 to fix it\n // https://github.com/coinjar/react-native-wagmi-charts/issues/24\n const minIndex = 0;\n const boundedIndex = Math.max(\n minIndex,\n Math.round(boundedX / width / (1 / (data.length - 1)))\n );\n\n currentIndex.value = boundedIndex;\n }\n },\n onEnd: () => {\n isActive.value = false;\n currentIndex.value = -1;\n },\n });\n\n return (\n <CursorContext.Provider value={{ type }}>\n <LongPressGestureHandler\n minDurationMs={0}\n maxDist={999999}\n onGestureEvent={onGestureEvent}\n {...props}\n >\n <Animated.View style={StyleSheet.absoluteFill}>\n {children}\n </Animated.View>\n </LongPressGestureHandler>\n </CursorContext.Provider>\n );\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
4
|
+
import { Platform, View } from 'react-native';
|
|
5
5
|
import Animated, { useAnimatedStyle, withSpring } from 'react-native-reanimated';
|
|
6
6
|
import { LineChartCursor } from './Cursor';
|
|
7
7
|
import { useLineChart } from './useLineChart';
|
|
8
|
+
LineChartCursorCrosshair.displayName = 'LineChartCursorCrosshair';
|
|
8
9
|
export function LineChartCursorCrosshair({
|
|
9
10
|
children,
|
|
10
11
|
color = 'black',
|
|
@@ -19,16 +20,21 @@ export function LineChartCursorCrosshair({
|
|
|
19
20
|
currentX,
|
|
20
21
|
currentY,
|
|
21
22
|
isActive
|
|
22
|
-
} = useLineChart();
|
|
23
|
+
} = useLineChart(); // It seems that enabling spring animation on initial render on Android causes a crash.
|
|
24
|
+
|
|
25
|
+
const [enableSpringAnimation, setEnableSpringAnimation] = React.useState(Platform.OS === 'ios');
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
setEnableSpringAnimation(true);
|
|
28
|
+
}, []);
|
|
23
29
|
const animatedCursorStyle = useAnimatedStyle(() => ({
|
|
24
30
|
transform: [{
|
|
25
31
|
translateX: currentX.value - outerSize / 2
|
|
26
32
|
}, {
|
|
27
33
|
translateY: currentY.value - outerSize / 2
|
|
28
34
|
}, {
|
|
29
|
-
scale: withSpring(isActive.value ? 1 : 0, {
|
|
35
|
+
scale: enableSpringAnimation ? withSpring(isActive.value ? 1 : 0, {
|
|
30
36
|
damping: 10
|
|
31
|
-
})
|
|
37
|
+
}) : 0
|
|
32
38
|
}]
|
|
33
39
|
}));
|
|
34
40
|
return /*#__PURE__*/React.createElement(LineChartCursor, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CursorCrosshair.tsx"],"names":["React","View","Animated","useAnimatedStyle","withSpring","LineChartCursor","useLineChart","LineChartCursorCrosshair","children","color","size","outerSize","crosshairWrapperProps","crosshairProps","crosshairOuterProps","props","currentX","currentY","isActive","animatedCursorStyle","transform","translateX","value","translateY","scale","damping","width","height","alignItems","justifyContent","style","backgroundColor","borderRadius","opacity","position"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,
|
|
1
|
+
{"version":3,"sources":["CursorCrosshair.tsx"],"names":["React","Platform","View","Animated","useAnimatedStyle","withSpring","LineChartCursor","useLineChart","LineChartCursorCrosshair","displayName","children","color","size","outerSize","crosshairWrapperProps","crosshairProps","crosshairOuterProps","props","currentX","currentY","isActive","enableSpringAnimation","setEnableSpringAnimation","useState","OS","useEffect","animatedCursorStyle","transform","translateX","value","translateY","scale","damping","width","height","alignItems","justifyContent","style","backgroundColor","borderRadius","opacity","position"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA0C,cAA1C;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,UAFF,QAGO,yBAHP;AAKA,SAASC,eAAT,QAAsD,UAAtD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAeAC,wBAAwB,CAACC,WAAzB,GAAuC,0BAAvC;AAEA,OAAO,SAASD,wBAAT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AAA,KAAK,EAAEpB,SADT;AAEEqB,MAAAA,MAAM,EAAErB,SAFV;AAGEsB,MAAAA,UAAU,EAAE,QAHd;AAIEC,MAAAA,cAAc,EAAE;AAJlB,KADK,EAOLV,mBAPK,EAQLZ,qBAAqB,CAACuB,KARjB;AAFT,mBAaE,oBAAC,IAAD,eACMrB,mBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEsB,MAAAA,eAAe,EAAE3B,KADnB;AAEEsB,MAAAA,KAAK,EAAEpB,SAFT;AAGEqB,MAAAA,MAAM,EAAErB,SAHV;AAIE0B,MAAAA,YAAY,EAAE1B,SAJhB;AAKE2B,MAAAA,OAAO,EAAE,GALX;AAMEC,MAAAA,QAAQ,EAAE;AANZ,KADK,EASLzB,mBAAmB,CAACqB,KATf;AAFT,KAbF,eA2BE,oBAAC,IAAD,eACMtB,cADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEuB,MAAAA,eAAe,EAAE3B,KADnB;AAEEsB,MAAAA,KAAK,EAAErB,IAFT;AAGEsB,MAAAA,MAAM,EAAEtB,IAHV;AAIE2B,MAAAA,YAAY,EAAE3B;AAJhB,KADK,EAOLG,cAAc,CAACsB,KAPV;AAFT,KA3BF,CADF,EAyCG3B,QAzCH,CADF;AA6CD","sourcesContent":["import * as React from 'react';\nimport { Platform, View, ViewProps } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n withSpring,\n} from 'react-native-reanimated';\n\nimport { LineChartCursor, LineChartCursorProps } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorCrosshairProps = Omit<\n LineChartCursorProps,\n 'children' | 'type'\n> & {\n children?: React.ReactNode;\n color?: string;\n size?: number;\n outerSize?: number;\n crosshairWrapperProps?: Animated.AnimateProps<ViewProps>;\n crosshairProps?: ViewProps;\n crosshairOuterProps?: ViewProps;\n};\n\nLineChartCursorCrosshair.displayName = 'LineChartCursorCrosshair';\n\nexport function LineChartCursorCrosshair({\n children,\n color = 'black',\n size = 8,\n outerSize = 32,\n crosshairWrapperProps = {},\n crosshairProps = {},\n crosshairOuterProps = {},\n ...props\n}: LineChartCursorCrosshairProps) {\n const { currentX, currentY, isActive } = useLineChart();\n\n // It seems that enabling spring animation on initial render on Android causes a crash.\n const [enableSpringAnimation, setEnableSpringAnimation] = React.useState(\n Platform.OS === 'ios'\n );\n React.useEffect(() => {\n setEnableSpringAnimation(true);\n }, []);\n\n const animatedCursorStyle = useAnimatedStyle(() => ({\n transform: [\n { translateX: currentX.value - outerSize / 2 },\n { translateY: currentY.value - outerSize / 2 },\n {\n scale: enableSpringAnimation\n ? withSpring(isActive.value ? 1 : 0, {\n damping: 10,\n })\n : 0,\n },\n ],\n }));\n\n return (\n <LineChartCursor type=\"crosshair\" {...props}>\n <Animated.View\n {...crosshairWrapperProps}\n style={[\n {\n width: outerSize,\n height: outerSize,\n alignItems: 'center',\n justifyContent: 'center',\n },\n animatedCursorStyle,\n crosshairWrapperProps.style,\n ]}\n >\n <View\n {...crosshairOuterProps}\n style={[\n {\n backgroundColor: color,\n width: outerSize,\n height: outerSize,\n borderRadius: outerSize,\n opacity: 0.1,\n position: 'absolute',\n },\n crosshairOuterProps.style,\n ]}\n />\n <View\n {...crosshairProps}\n style={[\n {\n backgroundColor: color,\n width: size,\n height: size,\n borderRadius: size,\n },\n crosshairProps.style,\n ]}\n />\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n}\n"]}
|
|
@@ -7,11 +7,12 @@ import Svg, { Line as SVGLine } from 'react-native-svg';
|
|
|
7
7
|
import { LineChartDimensionsContext } from './Chart';
|
|
8
8
|
import { LineChartCursor } from './Cursor';
|
|
9
9
|
import { useLineChart } from './useLineChart';
|
|
10
|
-
|
|
10
|
+
LineChartCursorLine.displayName = 'LineChartCursorLine';
|
|
11
|
+
export function LineChartCursorLine({
|
|
11
12
|
children,
|
|
12
13
|
color = 'gray',
|
|
13
14
|
lineProps = {}
|
|
14
|
-
})
|
|
15
|
+
}) {
|
|
15
16
|
const {
|
|
16
17
|
height
|
|
17
18
|
} = React.useContext(LineChartDimensionsContext);
|
|
@@ -41,7 +42,7 @@ export const LineChartCursorLine = ({
|
|
|
41
42
|
stroke: color,
|
|
42
43
|
strokeDasharray: "3 3"
|
|
43
44
|
}, lineProps)))), children);
|
|
44
|
-
}
|
|
45
|
+
}
|
|
45
46
|
const styles = StyleSheet.create({
|
|
46
47
|
svg: { ...StyleSheet.absoluteFillObject,
|
|
47
48
|
// height: 100% is required for <svg /> on web
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CursorLine.tsx"],"names":["React","StyleSheet","Animated","useAnimatedStyle","Svg","Line","SVGLine","LineChartDimensionsContext","LineChartCursor","useLineChart","LineChartCursorLine","children","color","lineProps","height","useContext","currentX","isActive","vertical","opacity","value","transform","translateX","styles","svg","create","absoluteFillObject"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,OAAOC,GAAP,IAAcC,IAAI,IAAIC,OAAtB,QAAgD,kBAAhD;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;
|
|
1
|
+
{"version":3,"sources":["CursorLine.tsx"],"names":["React","StyleSheet","Animated","useAnimatedStyle","Svg","Line","SVGLine","LineChartDimensionsContext","LineChartCursor","useLineChart","LineChartCursorLine","displayName","children","color","lineProps","height","useContext","currentX","isActive","vertical","opacity","value","transform","translateX","styles","svg","create","absoluteFillObject"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,OAAOC,GAAP,IAAcC,IAAI,IAAIC,OAAtB,QAAgD,kBAAhD;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,e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0B,kBADX;AAEH;AACAZ,IAAAA,MAAM,EAAE;AAHL;AAD0B,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport Svg, { Line as SVGLine, LineProps } from 'react-native-svg';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { LineChartCursor } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorLineProps = {\n children?: React.ReactNode;\n color?: string;\n lineProps?: Partial<LineProps>;\n};\n\nLineChartCursorLine.displayName = 'LineChartCursorLine';\n\nexport function LineChartCursorLine({\n children,\n color = 'gray',\n lineProps = {},\n}: LineChartCursorLineProps) {\n const { height } = React.useContext(LineChartDimensionsContext);\n const { currentX, isActive } = useLineChart();\n\n const vertical = useAnimatedStyle(() => ({\n opacity: isActive.value ? 1 : 0,\n height: '100%',\n transform: [{ translateX: currentX.value }],\n }));\n\n return (\n <LineChartCursor type=\"line\">\n <Animated.View style={vertical}>\n <Svg style={styles.svg}>\n <SVGLine\n x1={0}\n y1={0}\n x2={0}\n y2={height}\n strokeWidth={2}\n stroke={color}\n strokeDasharray=\"3 3\"\n {...lineProps}\n />\n </Svg>\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n}\n\nconst styles = StyleSheet.create({\n svg: {\n ...StyleSheet.absoluteFillObject,\n // height: 100% is required for <svg /> on web\n height: '100%',\n },\n});\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useLineChartDatetime } from './useDatetime';
|
|
3
3
|
import { AnimatedText } from '../../components/AnimatedText';
|
|
4
|
+
LineChartDatetimeText.displayName = 'LineChartDatetimeText';
|
|
4
5
|
export function LineChartDatetimeText({
|
|
5
6
|
locale,
|
|
6
7
|
options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DatetimeText.tsx"],"names":["React","useLineChartDatetime","AnimatedText","LineChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,oBAAT,QAAqC,eAArC;AAEA,SAASC,YAAT,QAA6B,+BAA7B;
|
|
1
|
+
{"version":3,"sources":["DatetimeText.tsx"],"names":["React","useLineChartDatetime","AnimatedText","LineChartDatetimeText","displayName","locale","options","format","variant","style","datetime"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,oBAAT,QAAqC,eAArC;AAEA,SAASC,YAAT,QAA6B,+BAA7B;AAUAC,qBAAqB,CAACC,WAAtB,GAAoC,uBAApC;AAEA,OAAO,SAASD,qBAAT,CAA+B;AACpCE,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpCC,EAAAA;AALoC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAGT,oBAAoB,CAAC;AAAEM,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAArC;AACA,sBAAO,oBAAC,YAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nLineChartDatetimeText.displayName = 'LineChartDatetimeText';\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
|