react-native-wagmi-charts 2.7.3 → 2.8.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 +42 -15
- package/lib/commonjs/charts/candle/Candle.js +177 -93
- package/lib/commonjs/charts/candle/Candle.js.map +1 -1
- package/lib/commonjs/charts/candle/Candles.js +66 -43
- package/lib/commonjs/charts/candle/Candles.js.map +1 -1
- package/lib/commonjs/charts/candle/Chart.js +38 -28
- package/lib/commonjs/charts/candle/Chart.js.map +1 -1
- package/lib/commonjs/charts/candle/Context.js +74 -43
- package/lib/commonjs/charts/candle/Context.js.map +1 -1
- package/lib/commonjs/charts/candle/Crosshair.js +190 -81
- package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js +140 -61
- package/lib/commonjs/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/commonjs/charts/candle/DatetimeText.js +19 -14
- package/lib/commonjs/charts/candle/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/candle/Line.js +73 -28
- package/lib/commonjs/charts/candle/Line.js.map +1 -1
- package/lib/commonjs/charts/candle/PriceText.js +19 -14
- package/lib/commonjs/charts/candle/PriceText.js.map +1 -1
- package/lib/commonjs/charts/candle/index.js +67 -64
- package/lib/commonjs/charts/candle/types.js +4 -4
- package/lib/commonjs/charts/candle/useCandleData.js +9 -12
- package/lib/commonjs/charts/candle/useCandlestickChart.js +10 -9
- package/lib/commonjs/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/commonjs/charts/candle/useDatetime.js +16 -18
- package/lib/commonjs/charts/candle/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/candle/usePrice.js +21 -22
- package/lib/commonjs/charts/candle/usePrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getDomain.js +5 -8
- package/lib/commonjs/charts/candle/utils/getHeight.js +12 -11
- package/lib/commonjs/charts/candle/utils/getPrice.js +12 -11
- package/lib/commonjs/charts/candle/utils/getY.js +12 -11
- package/lib/commonjs/charts/candle/utils/index.js +16 -16
- package/lib/commonjs/charts/line/Axis.js +402 -0
- package/lib/commonjs/charts/line/Axis.js.map +1 -0
- package/lib/commonjs/charts/line/Chart.js +140 -69
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +290 -90
- package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
- package/lib/commonjs/charts/line/Context.js +98 -40
- package/lib/commonjs/charts/line/Context.js.map +1 -1
- package/lib/commonjs/charts/line/Cursor.js +129 -75
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +151 -58
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +251 -45
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/Data.js +73 -35
- package/lib/commonjs/charts/line/Data.js.map +1 -1
- package/lib/commonjs/charts/line/DatetimeText.js +27 -14
- package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/line/Dot.js +150 -57
- package/lib/commonjs/charts/line/Dot.js.map +1 -1
- package/lib/commonjs/charts/line/Gradient.js +124 -54
- package/lib/commonjs/charts/line/Gradient.js.map +1 -1
- package/lib/commonjs/charts/line/Group.js +54 -24
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +115 -47
- package/lib/commonjs/charts/line/Highlight.js.map +1 -1
- package/lib/commonjs/charts/line/HorizontalLine.js +92 -40
- package/lib/commonjs/charts/line/HorizontalLine.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.js +10 -7
- package/lib/commonjs/charts/line/HoverTrap/index.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.web.js +115 -86
- package/lib/commonjs/charts/line/HoverTrap/index.web.js.map +1 -1
- package/lib/commonjs/charts/line/LineChartPathContext.js +14 -11
- package/lib/commonjs/charts/line/LineChartPathContext.js.map +1 -1
- package/lib/commonjs/charts/line/Path.js +78 -39
- package/lib/commonjs/charts/line/Path.js.map +1 -1
- package/lib/commonjs/charts/line/PriceText.js +113 -14
- package/lib/commonjs/charts/line/PriceText.js.map +1 -1
- package/lib/commonjs/charts/line/Tooltip.js +236 -106
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js +75 -62
- package/lib/commonjs/charts/line/index.js.map +1 -1
- package/lib/commonjs/charts/line/types.js +4 -4
- package/lib/commonjs/charts/line/useAnimatedPath.js +28 -23
- package/lib/commonjs/charts/line/useAnimatedPath.js.map +1 -1
- package/lib/commonjs/charts/line/useCurrentY.js +17 -17
- package/lib/commonjs/charts/line/useDatetime.js +34 -33
- package/lib/commonjs/charts/line/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/line/useLineChart.js +21 -17
- package/lib/commonjs/charts/line/useLineChart.js.map +1 -1
- package/lib/commonjs/charts/line/usePrice.js +30 -28
- package/lib/commonjs/charts/line/usePrice.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getArea.js +48 -20
- package/lib/commonjs/charts/line/utils/getArea.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getDomain.js +5 -7
- package/lib/commonjs/charts/line/utils/getPath.js +54 -20
- package/lib/commonjs/charts/line/utils/getPath.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +8 -5
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js.map +1 -1
- package/lib/commonjs/charts/line/utils/index.js +19 -19
- package/lib/commonjs/charts/line/utils/interpolatePath.js +102 -62
- package/lib/commonjs/charts/line/utils/interpolatePath.js.map +1 -1
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +5 -5
- package/lib/commonjs/components/AnimatedText.js +66 -39
- package/lib/commonjs/components/AnimatedText.js.map +1 -1
- package/lib/commonjs/index.js +27 -16
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/formatDatetime.js +5 -9
- package/lib/commonjs/utils/formatPrice.js +13 -9
- package/lib/commonjs/utils/formatPrice.js.map +1 -1
- package/lib/commonjs/utils/index.js +13 -13
- package/lib/commonjs/utils/usePrevious.js +10 -9
- package/lib/commonjs/utils/usePrevious.js.map +1 -1
- package/lib/module/charts/candle/Candle.js +126 -76
- package/lib/module/charts/candle/Candle.js.map +1 -1
- package/lib/module/charts/candle/Candles.js +53 -34
- package/lib/module/charts/candle/Candles.js.map +1 -1
- package/lib/module/charts/candle/Chart.js +23 -20
- package/lib/module/charts/candle/Chart.js.map +1 -1
- package/lib/module/charts/candle/Context.js +53 -23
- package/lib/module/charts/candle/Context.js.map +1 -1
- package/lib/module/charts/candle/Crosshair.js +151 -69
- package/lib/module/charts/candle/Crosshair.js.map +1 -1
- package/lib/module/charts/candle/CrosshairTooltip.js +102 -52
- package/lib/module/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/module/charts/candle/DatetimeText.js +5 -5
- package/lib/module/charts/candle/Line.js +37 -19
- package/lib/module/charts/candle/PriceText.js +5 -5
- package/lib/module/charts/candle/PriceText.js.map +1 -1
- package/lib/module/charts/candle/index.js +2 -2
- package/lib/module/charts/candle/types.js +1 -1
- package/lib/module/charts/candle/useCandleData.js +3 -7
- package/lib/module/charts/candle/useCandlestickChart.js +2 -2
- package/lib/module/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/module/charts/candle/useDatetime.js +10 -12
- package/lib/module/charts/candle/useDatetime.js.map +1 -1
- package/lib/module/charts/candle/usePrice.js +12 -14
- package/lib/module/charts/candle/usePrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getDomain.js +2 -5
- package/lib/module/charts/candle/utils/getHeight.js +8 -7
- package/lib/module/charts/candle/utils/getPrice.js +2 -6
- package/lib/module/charts/candle/utils/getY.js +2 -6
- package/lib/module/charts/candle/utils/index.js +1 -1
- package/lib/module/charts/line/Axis.js +349 -0
- package/lib/module/charts/line/Axis.js.map +1 -0
- package/lib/module/charts/line/Chart.js +82 -46
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +246 -77
- package/lib/module/charts/line/ChartPath.js.map +1 -1
- package/lib/module/charts/line/Context.js +65 -32
- package/lib/module/charts/line/Context.js.map +1 -1
- package/lib/module/charts/line/Cursor.js +86 -60
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +118 -50
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +210 -33
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/Data.js +41 -28
- package/lib/module/charts/line/Data.js.map +1 -1
- package/lib/module/charts/line/DatetimeText.js +14 -6
- package/lib/module/charts/line/DatetimeText.js.map +1 -1
- package/lib/module/charts/line/Dot.js +95 -41
- package/lib/module/charts/line/Dot.js.map +1 -1
- package/lib/module/charts/line/Gradient.js +80 -42
- package/lib/module/charts/line/Gradient.js.map +1 -1
- package/lib/module/charts/line/Group.js +15 -14
- package/lib/module/charts/line/Highlight.js +62 -32
- package/lib/module/charts/line/Highlight.js.map +1 -1
- package/lib/module/charts/line/HorizontalLine.js +49 -27
- package/lib/module/charts/line/HorizontalLine.js.map +1 -1
- package/lib/module/charts/line/HoverTrap/index.js +3 -2
- package/lib/module/charts/line/HoverTrap/index.web.js +102 -76
- package/lib/module/charts/line/HoverTrap/index.web.js.map +1 -1
- package/lib/module/charts/line/LineChartPathContext.js +3 -3
- package/lib/module/charts/line/Path.js +34 -27
- package/lib/module/charts/line/Path.js.map +1 -1
- package/lib/module/charts/line/PriceText.js +80 -6
- package/lib/module/charts/line/PriceText.js.map +1 -1
- package/lib/module/charts/line/Tooltip.js +202 -94
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js +6 -3
- package/lib/module/charts/line/index.js.map +1 -1
- package/lib/module/charts/line/types.js +1 -1
- package/lib/module/charts/line/useAnimatedPath.js +22 -16
- package/lib/module/charts/line/useAnimatedPath.js.map +1 -1
- package/lib/module/charts/line/useCurrentY.js +4 -9
- package/lib/module/charts/line/useDatetime.js +28 -27
- package/lib/module/charts/line/useDatetime.js.map +1 -1
- package/lib/module/charts/line/useLineChart.js +11 -8
- package/lib/module/charts/line/useLineChart.js.map +1 -1
- package/lib/module/charts/line/usePrice.js +24 -22
- package/lib/module/charts/line/usePrice.js.map +1 -1
- package/lib/module/charts/line/utils/getArea.js +16 -11
- package/lib/module/charts/line/utils/getArea.js.map +1 -1
- package/lib/module/charts/line/utils/getDomain.js +2 -4
- package/lib/module/charts/line/utils/getPath.js +22 -11
- package/lib/module/charts/line/utils/getPath.js.map +1 -1
- package/lib/module/charts/line/utils/getXPositionForCurve.js +5 -2
- package/lib/module/charts/line/utils/getXPositionForCurve.js.map +1 -1
- package/lib/module/charts/line/utils/index.js +1 -1
- package/lib/module/charts/line/utils/interpolatePath.js +99 -59
- package/lib/module/charts/line/utils/interpolatePath.js.map +1 -1
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js +2 -2
- package/lib/module/components/AnimatedText.js +24 -30
- package/lib/module/components/AnimatedText.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +1 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/formatDatetime.js +2 -6
- package/lib/module/utils/formatPrice.js +10 -6
- package/lib/module/utils/formatPrice.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/usePrevious.js +2 -2
- package/lib/module/utils/usePrevious.js.map +1 -1
- package/lib/typescript/src/charts/candle/Candle.d.ts +45 -31
- package/lib/typescript/src/charts/candle/Candle.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Candles.d.ts +25 -14
- package/lib/typescript/src/charts/candle/Candles.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Chart.d.ts +13 -8
- package/lib/typescript/src/charts/candle/Chart.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Context.d.ts +15 -8
- package/lib/typescript/src/charts/candle/Context.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Crosshair.d.ts +18 -10
- package/lib/typescript/src/charts/candle/Crosshair.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +16 -9
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts +16 -10
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Line.d.ts +10 -5
- package/lib/typescript/src/charts/candle/Line.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/PriceText.d.ts +15 -8
- package/lib/typescript/src/charts/candle/PriceText.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/index.d.ts +32 -14
- package/lib/typescript/src/charts/candle/index.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/types.d.ts +16 -19
- package/lib/typescript/src/charts/candle/types.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/useCandleData.d.ts +1 -1
- package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +1 -1
- package/lib/typescript/src/charts/candle/useDatetime.d.ts +14 -10
- package/lib/typescript/src/charts/candle/useDatetime.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/usePrice.d.ts +13 -8
- package/lib/typescript/src/charts/candle/usePrice.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +1 -1
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +9 -5
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +9 -5
- package/lib/typescript/src/charts/candle/utils/getY.d.ts +9 -5
- package/lib/typescript/src/charts/candle/utils/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/Axis.d.ts +33 -0
- package/lib/typescript/src/charts/line/Axis.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Chart.d.ts +33 -23
- package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts +29 -16
- package/lib/typescript/src/charts/line/ChartPath.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Context.d.ts +17 -10
- package/lib/typescript/src/charts/line/Context.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Cursor.d.ts +23 -13
- package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +24 -12
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts +19 -8
- package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Data.d.ts +17 -13
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +15 -9
- package/lib/typescript/src/charts/line/DatetimeText.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Dot.d.ts +39 -26
- package/lib/typescript/src/charts/line/Dot.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Gradient.d.ts +9 -5
- package/lib/typescript/src/charts/line/Gradient.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Group.d.ts +6 -3
- package/lib/typescript/src/charts/line/Highlight.d.ts +17 -9
- package/lib/typescript/src/charts/line/Highlight.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +30 -26
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +2 -2
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/LineChartPathContext.d.ts +4 -4
- package/lib/typescript/src/charts/line/Path.d.ts +28 -23
- package/lib/typescript/src/charts/line/Path.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/PriceText.d.ts +29 -13
- package/lib/typescript/src/charts/line/PriceText.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Tooltip.d.ts +34 -22
- package/lib/typescript/src/charts/line/Tooltip.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/index.d.ts +34 -20
- package/lib/typescript/src/charts/line/index.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/types.d.ts +19 -18
- package/lib/typescript/src/charts/line/types.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +10 -7
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useCurrentY.d.ts +2 -2
- package/lib/typescript/src/charts/line/useCurrentY.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useDatetime.d.ts +12 -8
- package/lib/typescript/src/charts/line/useDatetime.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useLineChart.d.ts +10 -10
- package/lib/typescript/src/charts/line/usePrice.d.ts +12 -8
- package/lib/typescript/src/charts/line/usePrice.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/utils/getArea.d.ts +17 -9
- package/lib/typescript/src/charts/line/utils/getArea.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/getPath.d.ts +21 -11
- package/lib/typescript/src/charts/line/utils/getPath.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts +17 -5
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +4 -2
- package/lib/typescript/src/components/AnimatedText.d.ts +7 -4
- package/lib/typescript/src/components/AnimatedText.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +8 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/formatDatetime.d.ts +9 -5
- package/lib/typescript/src/utils/formatPrice.d.ts +9 -5
- package/lib/typescript/src/utils/formatPrice.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -1
- package/lib/typescript/src/utils/usePrevious.d.ts +1 -1
- package/package.json +19 -43
- package/src/charts/candle/Candle.tsx +2 -17
- package/src/charts/candle/Candles.tsx +1 -3
- package/src/charts/candle/Chart.tsx +1 -1
- package/src/charts/candle/Context.tsx +30 -7
- package/src/charts/candle/Crosshair.tsx +20 -8
- package/src/charts/candle/CrosshairTooltip.tsx +3 -1
- package/src/charts/candle/DatetimeText.tsx +1 -1
- package/src/charts/candle/PriceText.tsx +2 -1
- package/src/charts/candle/types.ts +1 -7
- package/src/charts/candle/useCandlestickChart.ts +1 -1
- package/src/charts/candle/useDatetime.ts +3 -1
- package/src/charts/candle/usePrice.ts +5 -1
- package/src/charts/line/Axis.tsx +363 -0
- package/src/charts/line/Chart.tsx +10 -7
- package/src/charts/line/ChartPath.tsx +77 -18
- package/src/charts/line/Context.tsx +29 -18
- package/src/charts/line/Cursor.tsx +15 -11
- package/src/charts/line/CursorCrosshair.tsx +27 -8
- package/src/charts/line/CursorLine.tsx +177 -18
- package/src/charts/line/Data.tsx +6 -4
- package/src/charts/line/DatetimeText.tsx +12 -3
- package/src/charts/line/Dot.tsx +2 -2
- package/src/charts/line/Gradient.tsx +2 -5
- package/src/charts/line/Highlight.tsx +8 -4
- package/src/charts/line/HorizontalLine.tsx +2 -8
- package/src/charts/line/HoverTrap/index.web.tsx +93 -60
- package/src/charts/line/Path.tsx +10 -17
- package/src/charts/line/PriceText.tsx +74 -4
- package/src/charts/line/Tooltip.tsx +129 -63
- package/src/charts/line/index.ts +4 -1
- package/src/charts/line/types.ts +1 -2
- package/src/charts/line/useAnimatedPath.ts +1 -2
- package/src/charts/line/useDatetime.ts +13 -10
- package/src/charts/line/useLineChart.ts +1 -1
- package/src/charts/line/usePrice.ts +6 -4
- package/src/charts/line/utils/getArea.ts +12 -10
- package/src/charts/line/utils/getPath.ts +13 -10
- package/src/charts/line/utils/getXPositionForCurve.ts +1 -1
- package/src/charts/line/utils/interpolatePath.ts +2 -2
- package/src/components/AnimatedText.tsx +13 -20
- package/src/index.ts +1 -0
- package/src/types.ts +7 -0
- package/src/utils/formatPrice.ts +7 -7
- package/src/utils/usePrevious.ts +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TextProps as RNTextProps } from 'react-native';
|
|
3
3
|
import type { AnimatedProps } from 'react-native-reanimated';
|
|
4
|
-
|
|
4
|
+
import { useDerivedValue } from 'react-native-reanimated';
|
|
5
5
|
import { useLineChartDatetime } from './useDatetime';
|
|
6
|
-
import type { TFormatterFn } from '
|
|
6
|
+
import type { TFormatterFn } from '../../types';
|
|
7
7
|
import { AnimatedText } from '../../components/AnimatedText';
|
|
8
8
|
|
|
9
9
|
type LineChartDatetimeProps = {
|
|
@@ -24,5 +24,14 @@ export function LineChartDatetimeText({
|
|
|
24
24
|
style,
|
|
25
25
|
}: LineChartDatetimeProps) {
|
|
26
26
|
const datetime = useLineChartDatetime({ format, locale, options });
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
const text = useDerivedValue(() => {
|
|
29
|
+
const value = datetime[variant].value;
|
|
30
|
+
if (typeof value === 'number') {
|
|
31
|
+
return value === 0 || isNaN(value) ? '' : value.toString();
|
|
32
|
+
}
|
|
33
|
+
return value || '';
|
|
34
|
+
}, [datetime, variant]);
|
|
35
|
+
|
|
36
|
+
return <AnimatedText text={text} style={style} />;
|
|
28
37
|
}
|
package/src/charts/line/Dot.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import Animated, {
|
|
4
4
|
Easing,
|
|
@@ -93,7 +93,7 @@ export function LineChartDot({
|
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
const animatedOuterDotProps = useAnimatedProps(() => {
|
|
96
|
-
|
|
96
|
+
const defaultProps = {
|
|
97
97
|
cx: x.value,
|
|
98
98
|
cy: y.value,
|
|
99
99
|
opacity: 0.1,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Animated, { AnimatedProps } from 'react-native-reanimated';
|
|
3
3
|
import { Defs, LinearGradient, Stop, Path, PathProps } from 'react-native-svg';
|
|
4
|
-
|
|
5
4
|
import { LineChartDimensionsContext } from './Chart';
|
|
6
5
|
import { LineChartPathContext } from './LineChartPathContext';
|
|
7
|
-
import useAnimatedPath from './useAnimatedPath';
|
|
6
|
+
import { useAnimatedPath } from './useAnimatedPath';
|
|
8
7
|
|
|
9
8
|
const AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
10
9
|
|
|
@@ -25,7 +24,6 @@ export function LineChartGradient({
|
|
|
25
24
|
const { area } = React.useContext(LineChartDimensionsContext);
|
|
26
25
|
const { color: contextColor, isTransitionEnabled } =
|
|
27
26
|
React.useContext(LineChartPathContext);
|
|
28
|
-
|
|
29
27
|
const color = overrideColor || contextColor;
|
|
30
28
|
|
|
31
29
|
////////////////////////////////////////////////
|
|
@@ -52,8 +50,7 @@ export function LineChartGradient({
|
|
|
52
50
|
y1="0"
|
|
53
51
|
y2="100%"
|
|
54
52
|
>
|
|
55
|
-
{
|
|
56
|
-
{children}
|
|
53
|
+
{children as React.ReactElement[]}
|
|
57
54
|
</LinearGradient>
|
|
58
55
|
</Defs>
|
|
59
56
|
) : (
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Animated, { AnimatedProps } from 'react-native-reanimated';
|
|
3
3
|
import { ClipPath, Defs, G, Path, PathProps, Rect } from 'react-native-svg';
|
|
4
|
-
|
|
5
4
|
import { LineChartDimensionsContext } from './Chart';
|
|
6
5
|
import { LineChartPathContext } from './LineChartPathContext';
|
|
7
|
-
import useAnimatedPath from './useAnimatedPath';
|
|
6
|
+
import { useAnimatedPath } from './useAnimatedPath';
|
|
8
7
|
import { getXPositionForCurve } from './utils/getXPositionForCurve';
|
|
9
8
|
|
|
10
9
|
const AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
@@ -45,13 +44,18 @@ export function LineChartHighlight({
|
|
|
45
44
|
|
|
46
45
|
////////////////////////////////////////////////
|
|
47
46
|
|
|
47
|
+
const clipId = React.useMemo(
|
|
48
|
+
() => `clip-${Math.random().toString(36).substring(2, 11)}`,
|
|
49
|
+
[]
|
|
50
|
+
);
|
|
51
|
+
|
|
48
52
|
const clipStart = getXPositionForCurve(parsedPath, from);
|
|
49
53
|
const clipEnd = getXPositionForCurve(parsedPath, to);
|
|
50
54
|
|
|
51
55
|
return (
|
|
52
56
|
<G>
|
|
53
57
|
<Defs>
|
|
54
|
-
<ClipPath id=
|
|
58
|
+
<ClipPath id={clipId}>
|
|
55
59
|
<Rect
|
|
56
60
|
x={clipStart}
|
|
57
61
|
y="0"
|
|
@@ -62,7 +66,7 @@ export function LineChartHighlight({
|
|
|
62
66
|
</ClipPath>
|
|
63
67
|
</Defs>
|
|
64
68
|
<AnimatedPath
|
|
65
|
-
clipPath=
|
|
69
|
+
clipPath={`url(#${clipId})`}
|
|
66
70
|
animatedProps={animatedProps}
|
|
67
71
|
fill="transparent"
|
|
68
72
|
stroke={isInactive ? inactiveColor || color : color}
|
|
@@ -23,15 +23,11 @@ type HorizontalLineProps = {
|
|
|
23
23
|
* This may be useful to customize the line's position based on the thickness of your cursor or chart path.
|
|
24
24
|
*
|
|
25
25
|
* ```tsx
|
|
26
|
-
* <LineChart.HorizontalLine
|
|
27
|
-
* at={{ index: 3 }}
|
|
28
|
-
* />
|
|
26
|
+
* <LineChart.HorizontalLine at={{ index: 3 }} />
|
|
29
27
|
*
|
|
30
28
|
* // or
|
|
31
29
|
*
|
|
32
|
-
* <LineChart.HorizontalLine
|
|
33
|
-
* at={{ value: 320.32}}
|
|
34
|
-
* />
|
|
30
|
+
* <LineChart.HorizontalLine at={{ value: 320.32 }} />
|
|
35
31
|
* ```
|
|
36
32
|
*/
|
|
37
33
|
at?:
|
|
@@ -78,9 +74,7 @@ export function LineChartHorizontalLine({
|
|
|
78
74
|
|
|
79
75
|
const offsetTop = yDomain.max - at.value;
|
|
80
76
|
const percentageOffsetTop = offsetTop / (yDomain.max - yDomain.min);
|
|
81
|
-
|
|
82
77
|
const heightBetweenGutters = height - gutter * 2;
|
|
83
|
-
|
|
84
78
|
const offsetTopPixels = gutter + percentageOffsetTop * heightBetweenGutters;
|
|
85
79
|
|
|
86
80
|
return withTiming(offsetTopPixels + offsetY);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { LineChartDimensionsContext } from '../Chart';
|
|
@@ -6,74 +6,116 @@ import { useLineChart } from '../useLineChart';
|
|
|
6
6
|
|
|
7
7
|
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Minimum time in milliseconds that must pass between touch events before a
|
|
11
|
+
* hover state is activated on web.
|
|
12
|
+
*/
|
|
13
|
+
const HOVER_THRESHOLD_MS = 1000;
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* (including for multi-modality devices) and considers "hover" to be enabled
|
|
20
|
-
* if a mouse movement occurs more than 1 second after the last touch event.
|
|
21
|
-
* This threshold is long enough to account for longer delays between the
|
|
22
|
-
* browser firing touch and mouse events on low-powered devices.
|
|
23
|
-
*/
|
|
24
|
-
const HOVER_THRESHOLD_MS = 1000;
|
|
25
|
-
let lastTouchTimestamp = 0;
|
|
15
|
+
/**
|
|
16
|
+
* Hover state manager for web platform. This singleton ensures global hover
|
|
17
|
+
* detection is properly initialized and cleaned up.
|
|
18
|
+
*/
|
|
19
|
+
class HoverStateManager {
|
|
20
|
+
private isEnabled = false;
|
|
21
|
+
private lastTouchTimestamp = 0;
|
|
22
|
+
private initialized = false;
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
24
|
+
constructor() {
|
|
25
|
+
if (canUseDOM) {
|
|
26
|
+
this.initialize();
|
|
30
27
|
}
|
|
31
|
-
isEnabled = true;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
private initialize() {
|
|
31
|
+
if (this.initialized) return;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The following logic comes from the creator of react-native-web:
|
|
35
|
+
* https://gist.github.com/necolas/1c494e44e23eb7f8c5864a2fac66299a
|
|
36
|
+
* It's also used by MotiPressable's hover interactions:
|
|
37
|
+
* https://github.com/nandorojo/moti/blob/master/packages/interactions/src/pressable/hoverable.tsx
|
|
38
|
+
*
|
|
39
|
+
* Web browsers emulate mouse events (and hover states) after touch events.
|
|
40
|
+
* This code infers when the currently-in-use modality supports hover
|
|
41
|
+
* (including for multi-modality devices) and considers "hover" to be enabled
|
|
42
|
+
* if a mouse movement occurs more than 1 second after the last touch event.
|
|
43
|
+
* This threshold is long enough to account for longer delays between the
|
|
44
|
+
* browser firing touch and mouse events on low-powered devices.
|
|
45
|
+
*/
|
|
46
|
+
document.addEventListener('touchstart', this.disableHover, true);
|
|
47
|
+
document.addEventListener('touchmove', this.disableHover, true);
|
|
48
|
+
document.addEventListener('mousemove', this.enableHover, true);
|
|
49
|
+
this.initialized = true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private enableHover = () => {
|
|
53
|
+
if (
|
|
54
|
+
this.isEnabled ||
|
|
55
|
+
Date.now() - this.lastTouchTimestamp < HOVER_THRESHOLD_MS
|
|
56
|
+
) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.isEnabled = true;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
private disableHover = () => {
|
|
63
|
+
this.lastTouchTimestamp = Date.now();
|
|
64
|
+
if (this.isEnabled) {
|
|
65
|
+
this.isEnabled = false;
|
|
38
66
|
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
public isHoverEnabled(): boolean {
|
|
70
|
+
return this.isEnabled;
|
|
39
71
|
}
|
|
40
72
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Cleanup method for removing event listeners. Note: In practice, this may
|
|
75
|
+
* never be called since these are app-level listeners, but it's provided for
|
|
76
|
+
* completeness and testing purposes.
|
|
77
|
+
*/
|
|
78
|
+
public cleanup() {
|
|
79
|
+
if (!this.initialized || !canUseDOM) return;
|
|
80
|
+
document.removeEventListener('touchstart', this.disableHover, true);
|
|
81
|
+
document.removeEventListener('touchmove', this.disableHover, true);
|
|
82
|
+
document.removeEventListener('mousemove', this.enableHover, true);
|
|
83
|
+
this.initialized = false;
|
|
84
|
+
}
|
|
44
85
|
}
|
|
45
86
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
87
|
+
// Singleton instance
|
|
88
|
+
const hoverStateManager = new HoverStateManager();
|
|
49
89
|
|
|
50
90
|
export const LineChartHoverTrap = () => {
|
|
51
91
|
const { width, parsedPath } = React.useContext(LineChartDimensionsContext);
|
|
52
92
|
const { currentX, currentIndex, isActive, data } = useLineChart();
|
|
53
93
|
|
|
54
94
|
const onMouseMove = React.useCallback(
|
|
55
|
-
(
|
|
56
|
-
if (isHoverEnabled()) {
|
|
57
|
-
if (parsedPath) {
|
|
58
|
-
const boundedX = Math.min(x, width);
|
|
59
|
-
isActive.value = true;
|
|
60
|
-
currentX.value = boundedX;
|
|
61
|
-
|
|
62
|
-
// on Web, we could drag the cursor to be negative, breaking it
|
|
63
|
-
// so we clamp the index at 0 to fix it
|
|
64
|
-
// https://github.com/coinjar/react-native-wagmi-charts/issues/24
|
|
65
|
-
const minIndex = 0;
|
|
66
|
-
const boundedIndex = Math.max(
|
|
67
|
-
minIndex,
|
|
68
|
-
Math.round(boundedX / width / (1 / (data ? data.length - 1 : 1)))
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
currentIndex.value = boundedIndex;
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
95
|
+
(e: React.MouseEvent<HTMLElement>) => {
|
|
96
|
+
if (!hoverStateManager.isHoverEnabled()) {
|
|
74
97
|
isActive.value = false;
|
|
75
98
|
currentIndex.value = -1;
|
|
99
|
+
return;
|
|
76
100
|
}
|
|
101
|
+
|
|
102
|
+
if (!parsedPath) return;
|
|
103
|
+
|
|
104
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
105
|
+
const boundedX = Math.min(e.clientX - rect.left, width);
|
|
106
|
+
isActive.value = true;
|
|
107
|
+
currentX.value = boundedX;
|
|
108
|
+
|
|
109
|
+
// on Web, we could drag the cursor to be negative, breaking it
|
|
110
|
+
// so we clamp the index at 0 to fix it
|
|
111
|
+
// https://github.com/coinjar/react-native-wagmi-charts/issues/24
|
|
112
|
+
const minIndex = 0;
|
|
113
|
+
const boundedIndex = Math.max(
|
|
114
|
+
minIndex,
|
|
115
|
+
Math.round(boundedX / width / (1 / (data ? data.length - 1 : 1)))
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
currentIndex.value = boundedIndex;
|
|
77
119
|
},
|
|
78
120
|
[currentIndex, currentX, data, isActive, parsedPath, width]
|
|
79
121
|
);
|
|
@@ -87,16 +129,7 @@ export const LineChartHoverTrap = () => {
|
|
|
87
129
|
<View
|
|
88
130
|
style={StyleSheet.absoluteFill}
|
|
89
131
|
// @ts-expect-error mouse move event
|
|
90
|
-
onMouseMove={
|
|
91
|
-
// eslint-disable-next-line no-undef
|
|
92
|
-
(e: React.MouseEvent<HTMLElement>) => {
|
|
93
|
-
let rect = e.currentTarget.getBoundingClientRect();
|
|
94
|
-
let x = e.clientX - rect.left; // x position within the element.
|
|
95
|
-
|
|
96
|
-
onMouseMove({ x });
|
|
97
|
-
},
|
|
98
|
-
[onMouseMove]
|
|
99
|
-
)}
|
|
132
|
+
onMouseMove={onMouseMove}
|
|
100
133
|
onMouseLeave={onMouseLeave}
|
|
101
134
|
/>
|
|
102
135
|
);
|
package/src/charts/line/Path.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Animated, { AnimatedProps } from 'react-native-reanimated';
|
|
3
3
|
import { Path, PathProps } from 'react-native-svg';
|
|
4
|
-
|
|
5
4
|
import { LineChartDimensionsContext } from './Chart';
|
|
6
5
|
import { LineChartPathContext } from './LineChartPathContext';
|
|
7
|
-
import useAnimatedPath from './useAnimatedPath';
|
|
6
|
+
import { useAnimatedPath } from './useAnimatedPath';
|
|
8
7
|
|
|
9
8
|
const AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
10
9
|
|
|
@@ -20,7 +19,7 @@ export type LineChartPathProps = AnimatedProps<PathProps> & {
|
|
|
20
19
|
*
|
|
21
20
|
* While this use case is rare, it may be useful on web, where animations might not work as well.
|
|
22
21
|
*
|
|
23
|
-
|
|
22
|
+
***Example**
|
|
24
23
|
*
|
|
25
24
|
* ```tsx
|
|
26
25
|
* <LineChart.Path
|
|
@@ -43,25 +42,19 @@ export function LineChartPath({
|
|
|
43
42
|
const { isTransitionEnabled, isInactive } =
|
|
44
43
|
React.useContext(LineChartPathContext);
|
|
45
44
|
|
|
46
|
-
////////////////////////////////////////////////
|
|
47
|
-
|
|
48
45
|
const { animatedProps } = useAnimatedPath({
|
|
49
46
|
enabled: isTransitionEnabled,
|
|
50
47
|
path,
|
|
51
48
|
});
|
|
52
49
|
|
|
53
|
-
////////////////////////////////////////////////
|
|
54
|
-
|
|
55
50
|
return (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/>
|
|
65
|
-
</>
|
|
51
|
+
<AnimatedPath
|
|
52
|
+
animatedProps={animatedProps}
|
|
53
|
+
fill="transparent"
|
|
54
|
+
stroke={isInactive ? inactiveColor || color : color}
|
|
55
|
+
strokeOpacity={isInactive && !inactiveColor ? 0.2 : 1}
|
|
56
|
+
strokeWidth={strokeWidth}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
66
59
|
);
|
|
67
60
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Text, TextStyle } from 'react-native';
|
|
3
|
+
import type { TextProps as RNTextProps, StyleProp } from 'react-native';
|
|
3
4
|
import type { AnimatedProps } from 'react-native-reanimated';
|
|
4
|
-
|
|
5
|
+
import {
|
|
6
|
+
useDerivedValue,
|
|
7
|
+
useAnimatedReaction,
|
|
8
|
+
runOnJS,
|
|
9
|
+
} from 'react-native-reanimated';
|
|
5
10
|
import { useLineChartPrice } from './usePrice';
|
|
6
|
-
import
|
|
11
|
+
import { useLineChart } from './useLineChart';
|
|
12
|
+
import type { TFormatterFn } from '../../types';
|
|
7
13
|
import { AnimatedText } from '../../components/AnimatedText';
|
|
8
14
|
|
|
9
15
|
export type LineChartPriceTextProps = {
|
|
@@ -16,6 +22,14 @@ export type LineChartPriceTextProps = {
|
|
|
16
22
|
* If this is set it will use the index provided.
|
|
17
23
|
*/
|
|
18
24
|
index?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Use optimized rendering for high-frequency updates (bypasses AnimatedText)
|
|
27
|
+
*/
|
|
28
|
+
useOptimizedRendering?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Function to determine text color based on the formatted value
|
|
31
|
+
*/
|
|
32
|
+
getTextColor?: (formattedValue: string) => string;
|
|
19
33
|
};
|
|
20
34
|
|
|
21
35
|
LineChartPriceText.displayName = 'LineChartPriceText';
|
|
@@ -26,7 +40,63 @@ export function LineChartPriceText({
|
|
|
26
40
|
variant = 'formatted',
|
|
27
41
|
style,
|
|
28
42
|
index,
|
|
43
|
+
useOptimizedRendering = false,
|
|
44
|
+
getTextColor,
|
|
29
45
|
}: LineChartPriceTextProps) {
|
|
30
46
|
const price = useLineChartPrice({ format, precision, index });
|
|
47
|
+
|
|
48
|
+
// If we have a custom format function and optimized rendering is enabled,
|
|
49
|
+
// use regular React state instead of AnimatedText
|
|
50
|
+
if (format && useOptimizedRendering) {
|
|
51
|
+
const { currentIndex, data } = useLineChart();
|
|
52
|
+
const [displayText, setDisplayText] = useState('');
|
|
53
|
+
const [textColor, setTextColor] = useState('#000000');
|
|
54
|
+
|
|
55
|
+
const updateText = (newText: string) => {
|
|
56
|
+
setDisplayText(newText);
|
|
57
|
+
// Update color if getTextColor function is provided
|
|
58
|
+
if (getTextColor) {
|
|
59
|
+
setTextColor(getTextColor(newText));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const textValue = useDerivedValue(() => {
|
|
64
|
+
if (!data) {
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
if (
|
|
68
|
+
(typeof currentIndex.value === 'undefined' ||
|
|
69
|
+
currentIndex.value === -1) &&
|
|
70
|
+
index == null
|
|
71
|
+
) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
let price = 0;
|
|
75
|
+
price =
|
|
76
|
+
data[Math.min(index ?? currentIndex.value, data.length - 1)]!.value;
|
|
77
|
+
const valueString = price.toFixed(precision).toString();
|
|
78
|
+
|
|
79
|
+
// Call format function directly in worklet
|
|
80
|
+
return format({ value: valueString, formatted: valueString });
|
|
81
|
+
}, [currentIndex, data, precision]);
|
|
82
|
+
|
|
83
|
+
// Use useAnimatedReaction to update React state with runOnJS
|
|
84
|
+
useAnimatedReaction(
|
|
85
|
+
() => textValue.value,
|
|
86
|
+
(current, previous) => {
|
|
87
|
+
if (current !== previous) {
|
|
88
|
+
runOnJS(updateText)(current);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[textValue]
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// Merge the text color with the provided style
|
|
95
|
+
const dynamicStyle = [style, { color: textColor }] as StyleProp<TextStyle>;
|
|
96
|
+
|
|
97
|
+
return <Text style={dynamicStyle}>{displayText}</Text>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// For non-custom format, use the original approach
|
|
31
101
|
return <AnimatedText text={price[variant]} style={style} />;
|
|
32
102
|
}
|