react-native-wagmi-charts 2.4.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/lib/commonjs/charts/candle/Candle.js +1 -1
- package/lib/commonjs/charts/candle/Candle.js.map +1 -1
- package/lib/commonjs/charts/candle/Candles.js +1 -1
- package/lib/commonjs/charts/candle/Candles.js.map +1 -1
- package/lib/commonjs/charts/candle/Chart.js +1 -1
- package/lib/commonjs/charts/candle/Chart.js.map +1 -1
- package/lib/commonjs/charts/candle/Context.js +1 -1
- package/lib/commonjs/charts/candle/Context.js.map +1 -1
- package/lib/commonjs/charts/candle/Crosshair.js +1 -1
- package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/commonjs/charts/candle/DatetimeText.js +0 -3
- package/lib/commonjs/charts/candle/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/candle/Line.js +3 -5
- package/lib/commonjs/charts/candle/Line.js.map +1 -1
- package/lib/commonjs/charts/candle/PriceText.js +0 -3
- package/lib/commonjs/charts/candle/PriceText.js.map +1 -1
- package/lib/commonjs/charts/candle/index.js.map +1 -1
- package/lib/commonjs/charts/candle/types.js.map +1 -1
- package/lib/commonjs/charts/candle/useCandleData.js.map +1 -1
- package/lib/commonjs/charts/candle/useCandlestickChart.js +1 -1
- package/lib/commonjs/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/commonjs/charts/candle/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/candle/usePrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getY.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/index.js.map +1 -1
- package/lib/commonjs/charts/line/Chart.js +4 -5
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +9 -3
- package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
- package/lib/commonjs/charts/line/Context.js +3 -2
- package/lib/commonjs/charts/line/Context.js.map +1 -1
- package/lib/commonjs/charts/line/Cursor.js +3 -3
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +1 -1
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/Data.js +3 -5
- package/lib/commonjs/charts/line/Data.js.map +1 -1
- package/lib/commonjs/charts/line/DatetimeText.js +0 -3
- package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/line/Dot.js +3 -3
- package/lib/commonjs/charts/line/Dot.js.map +1 -1
- package/lib/commonjs/charts/line/Gradient.js +1 -1
- package/lib/commonjs/charts/line/Gradient.js.map +1 -1
- package/lib/commonjs/charts/line/Group.js +2 -4
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +1 -1
- package/lib/commonjs/charts/line/Highlight.js.map +1 -1
- package/lib/commonjs/charts/line/HorizontalLine.js +1 -1
- package/lib/commonjs/charts/line/HorizontalLine.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.js +1 -3
- package/lib/commonjs/charts/line/HoverTrap/index.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.web.js +3 -3
- package/lib/commonjs/charts/line/HoverTrap/index.web.js.map +1 -1
- package/lib/commonjs/charts/line/LineChartPathContext.js.map +1 -1
- package/lib/commonjs/charts/line/Path.js +1 -1
- package/lib/commonjs/charts/line/Path.js.map +1 -1
- package/lib/commonjs/charts/line/PriceText.js +0 -3
- package/lib/commonjs/charts/line/PriceText.js.map +1 -1
- package/lib/commonjs/charts/line/Tooltip.js +1 -1
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js.map +1 -1
- package/lib/commonjs/charts/line/types.js.map +1 -1
- package/lib/commonjs/charts/line/useAnimatedPath.js.map +1 -1
- package/lib/commonjs/charts/line/useCurrentY.js.map +1 -1
- package/lib/commonjs/charts/line/useDatetime.js +4 -2
- package/lib/commonjs/charts/line/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/line/useLineChart.js +1 -1
- package/lib/commonjs/charts/line/useLineChart.js.map +1 -1
- package/lib/commonjs/charts/line/usePrice.js +6 -1
- package/lib/commonjs/charts/line/usePrice.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getArea.js +2 -2
- package/lib/commonjs/charts/line/utils/getArea.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getPath.js +2 -2
- package/lib/commonjs/charts/line/utils/getPath.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +5 -1
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js.map +1 -1
- package/lib/commonjs/charts/line/utils/index.js.map +1 -1
- package/lib/commonjs/charts/line/utils/interpolatePath.js.map +1 -1
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js.map +1 -1
- package/lib/commonjs/components/AnimatedText.js +1 -1
- package/lib/commonjs/components/AnimatedText.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/formatDatetime.js.map +1 -1
- package/lib/commonjs/utils/formatPrice.js.map +1 -1
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/usePrevious.js +1 -1
- package/lib/commonjs/utils/usePrevious.js.map +1 -1
- package/lib/module/charts/candle/Candle.js.map +1 -1
- package/lib/module/charts/candle/Candles.js.map +1 -1
- package/lib/module/charts/candle/Chart.js.map +1 -1
- package/lib/module/charts/candle/Context.js.map +1 -1
- package/lib/module/charts/candle/Crosshair.js.map +1 -1
- package/lib/module/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/module/charts/candle/DatetimeText.js +0 -1
- package/lib/module/charts/candle/DatetimeText.js.map +1 -1
- package/lib/module/charts/candle/Line.js +0 -1
- package/lib/module/charts/candle/Line.js.map +1 -1
- package/lib/module/charts/candle/PriceText.js +0 -1
- package/lib/module/charts/candle/PriceText.js.map +1 -1
- package/lib/module/charts/candle/index.js.map +1 -1
- package/lib/module/charts/candle/types.js.map +1 -1
- package/lib/module/charts/candle/useCandleData.js.map +1 -1
- package/lib/module/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/module/charts/candle/useDatetime.js.map +1 -1
- package/lib/module/charts/candle/usePrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/module/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/module/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getY.js.map +1 -1
- package/lib/module/charts/candle/utils/index.js.map +1 -1
- package/lib/module/charts/line/Chart.js +3 -4
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +8 -2
- package/lib/module/charts/line/ChartPath.js.map +1 -1
- package/lib/module/charts/line/Context.js +2 -1
- package/lib/module/charts/line/Context.js.map +1 -1
- package/lib/module/charts/line/Cursor.js +2 -2
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/Data.js +1 -1
- package/lib/module/charts/line/Data.js.map +1 -1
- package/lib/module/charts/line/DatetimeText.js +0 -1
- package/lib/module/charts/line/DatetimeText.js.map +1 -1
- package/lib/module/charts/line/Dot.js +2 -2
- package/lib/module/charts/line/Dot.js.map +1 -1
- package/lib/module/charts/line/Gradient.js.map +1 -1
- package/lib/module/charts/line/Group.js +0 -1
- package/lib/module/charts/line/Group.js.map +1 -1
- package/lib/module/charts/line/Highlight.js.map +1 -1
- package/lib/module/charts/line/HorizontalLine.js.map +1 -1
- package/lib/module/charts/line/HoverTrap/index.js +0 -1
- package/lib/module/charts/line/HoverTrap/index.js.map +1 -1
- package/lib/module/charts/line/HoverTrap/index.web.js +2 -2
- package/lib/module/charts/line/HoverTrap/index.web.js.map +1 -1
- package/lib/module/charts/line/LineChartPathContext.js.map +1 -1
- package/lib/module/charts/line/Path.js.map +1 -1
- package/lib/module/charts/line/PriceText.js +0 -1
- package/lib/module/charts/line/PriceText.js.map +1 -1
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js.map +1 -1
- package/lib/module/charts/line/types.js.map +1 -1
- package/lib/module/charts/line/useAnimatedPath.js.map +1 -1
- package/lib/module/charts/line/useCurrentY.js.map +1 -1
- package/lib/module/charts/line/useDatetime.js +4 -2
- package/lib/module/charts/line/useDatetime.js.map +1 -1
- package/lib/module/charts/line/useLineChart.js.map +1 -1
- package/lib/module/charts/line/usePrice.js +6 -1
- package/lib/module/charts/line/usePrice.js.map +1 -1
- package/lib/module/charts/line/utils/getArea.js +1 -1
- package/lib/module/charts/line/utils/getArea.js.map +1 -1
- package/lib/module/charts/line/utils/getDomain.js.map +1 -1
- package/lib/module/charts/line/utils/getPath.js +1 -1
- package/lib/module/charts/line/utils/getPath.js.map +1 -1
- package/lib/module/charts/line/utils/getXPositionForCurve.js +5 -1
- package/lib/module/charts/line/utils/getXPositionForCurve.js.map +1 -1
- package/lib/module/charts/line/utils/index.js.map +1 -1
- package/lib/module/charts/line/utils/interpolatePath.js.map +1 -1
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js.map +1 -1
- package/lib/module/components/AnimatedText.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/formatDatetime.js.map +1 -1
- package/lib/module/utils/formatPrice.js.map +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/usePrevious.js.map +1 -1
- package/lib/typescript/src/charts/candle/Candle.d.ts +2 -2
- package/lib/typescript/src/charts/candle/Candle.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Candles.d.ts +1 -2
- package/lib/typescript/src/charts/candle/Candles.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Chart.d.ts +1 -1
- package/lib/typescript/src/charts/candle/Chart.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Context.d.ts +1 -1
- package/lib/typescript/src/charts/candle/Context.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Crosshair.d.ts +1 -1
- package/lib/typescript/src/charts/candle/Crosshair.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +4 -4
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts +1 -2
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/Line.d.ts +1 -2
- package/lib/typescript/src/charts/candle/Line.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/PriceText.d.ts +1 -2
- package/lib/typescript/src/charts/candle/PriceText.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/index.d.ts +2 -3
- package/lib/typescript/src/charts/candle/index.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/types.d.ts +3 -3
- package/lib/typescript/src/charts/candle/types.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/useCandleData.d.ts +2 -2
- package/lib/typescript/src/charts/candle/useCandleData.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/useDatetime.d.ts +3 -3
- package/lib/typescript/src/charts/candle/useDatetime.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/usePrice.d.ts +3 -3
- package/lib/typescript/src/charts/candle/usePrice.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Chart.d.ts +1 -1
- package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts +1 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Context.d.ts +1 -1
- package/lib/typescript/src/charts/line/Context.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Cursor.d.ts +1 -1
- package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +1 -1
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts +1 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Data.d.ts +3 -4
- package/lib/typescript/src/charts/line/Data.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +1 -2
- package/lib/typescript/src/charts/line/DatetimeText.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Dot.d.ts +1 -2
- package/lib/typescript/src/charts/line/Dot.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Gradient.d.ts +1 -1
- package/lib/typescript/src/charts/line/Gradient.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Group.d.ts +1 -2
- package/lib/typescript/src/charts/line/Group.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Highlight.d.ts +1 -2
- package/lib/typescript/src/charts/line/Highlight.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +1 -2
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +1 -2
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +1 -2
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Path.d.ts +1 -2
- package/lib/typescript/src/charts/line/Path.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/PriceText.d.ts +1 -2
- package/lib/typescript/src/charts/line/PriceText.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Tooltip.d.ts +1 -1
- package/lib/typescript/src/charts/line/Tooltip.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/index.d.ts +1 -2
- package/lib/typescript/src/charts/line/index.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/types.d.ts +4 -4
- package/lib/typescript/src/charts/line/types.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useCurrentY.d.ts +1 -3
- package/lib/typescript/src/charts/line/useCurrentY.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useDatetime.d.ts +2 -6
- package/lib/typescript/src/charts/line/useDatetime.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/useLineChart.d.ts +5 -13
- package/lib/typescript/src/charts/line/useLineChart.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/usePrice.d.ts +2 -6
- package/lib/typescript/src/charts/line/usePrice.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts.map +1 -1
- package/lib/typescript/src/components/AnimatedText.d.ts +4 -5
- package/lib/typescript/src/components/AnimatedText.d.ts.map +1 -1
- package/package.json +19 -13
- package/src/charts/candle/Candle.tsx +2 -8
- package/src/charts/candle/Context.tsx +3 -4
- package/src/charts/candle/CrosshairTooltip.tsx +12 -5
- package/src/charts/candle/DatetimeText.tsx +0 -1
- package/src/charts/candle/Line.tsx +0 -1
- package/src/charts/candle/PriceText.tsx +0 -1
- package/src/charts/candle/types.ts +3 -3
- package/src/charts/candle/useCandleData.ts +4 -4
- package/src/charts/candle/useDatetime.ts +4 -3
- package/src/charts/candle/usePrice.ts +4 -3
- package/src/charts/line/Chart.tsx +4 -5
- package/src/charts/line/ChartPath.tsx +4 -0
- package/src/charts/line/Context.tsx +10 -7
- package/src/charts/line/Cursor.tsx +3 -3
- package/src/charts/line/Data.tsx +1 -1
- package/src/charts/line/DatetimeText.tsx +0 -1
- package/src/charts/line/Dot.tsx +2 -0
- package/src/charts/line/Group.tsx +0 -1
- package/src/charts/line/HoverTrap/index.tsx +0 -2
- package/src/charts/line/HoverTrap/index.web.tsx +2 -2
- package/src/charts/line/PriceText.tsx +0 -1
- package/src/charts/line/types.ts +4 -4
- package/src/charts/line/useDatetime.ts +7 -2
- package/src/charts/line/usePrice.ts +8 -2
- package/src/charts/line/utils/getArea.ts +1 -1
- package/src/charts/line/utils/getPath.ts +1 -1
- package/src/charts/line/utils/getXPositionForCurve.ts +11 -1
- package/src/components/AnimatedText.tsx +3 -3
- package/src/utils/formatPrice.ts +1 -1
- package/.DS_Store +0 -0
- package/.editorconfig +0 -15
- package/.gitattributes +0 -3
- package/.gitignore +0 -60
- package/.husky/pre-commit +0 -4
- package/.prettierrc.js +0 -5
- package/.yarnrc +0 -3
- package/babel.config.js +0 -3
- package/example/.expo/README.md +0 -8
- package/example/.expo/devices.json +0 -3
- package/example/README.md +0 -41
- package/example/app.json +0 -22
- package/example/babel.config.js +0 -23
- package/example/index.js +0 -8
- package/example/metro.config.js +0 -40
- package/example/package.json +0 -42
- package/example/src/App.tsx +0 -64
- package/example/src/CandlestickChart.tsx +0 -155
- package/example/src/LineChart.tsx +0 -268
- package/example/src/data/candlestick-data.json +0 -142
- package/example/src/data/candlestick-data2.json +0 -142
- package/example/src/data/line-data-non-linear-domain.json +0 -34
- package/example/src/data/line-data.json +0 -82
- package/example/src/data/line-data2.json +0 -82
- package/example/src/line-data-gh.json +0 -18
- package/example/tsconfig.json +0 -6
- package/example/webpack.config.js +0 -25
- package/example/yarn.lock +0 -9306
- package/lib/commonjs/charts/candle/HoverTrap/index.web.js +0 -106
- package/lib/commonjs/charts/candle/HoverTrap/index.web.js.map +0 -1
- package/lib/commonjs/charts/candle/utils.js +0 -50
- package/lib/commonjs/charts/candle/utils.js.map +0 -1
- package/lib/module/charts/candle/HoverTrap/index.web.js +0 -97
- package/lib/module/charts/candle/HoverTrap/index.web.js.map +0 -1
- package/lib/module/charts/candle/utils.js +0 -41
- package/lib/module/charts/candle/utils.js.map +0 -1
- package/lib/typescript/example/src/App.d.ts +0 -4
- package/lib/typescript/example/src/App.d.ts.map +0 -1
- package/lib/typescript/example/src/CandlestickChart.d.ts +0 -3
- package/lib/typescript/example/src/CandlestickChart.d.ts.map +0 -1
- package/lib/typescript/example/src/LineChart.d.ts +0 -3
- package/lib/typescript/example/src/LineChart.d.ts.map +0 -1
- package/lib/typescript/src/charts/candle/HoverTrap/index.web.d.ts +0 -3
- package/lib/typescript/src/charts/candle/HoverTrap/index.web.d.ts.map +0 -1
- package/lib/typescript/src/charts/candle/utils.d.ts +0 -18
- package/lib/typescript/src/charts/candle/utils.d.ts.map +0 -1
- package/scripts/bootstrap.js +0 -24
- package/src/charts/candle/HoverTrap/index.web.tsx +0 -109
- package/src/charts/candle/utils.ts +0 -56
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -28
- package/yarn.lock +0 -8529
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useDerivedValue } from 'react-native-reanimated';
|
|
2
2
|
|
|
3
3
|
import { formatDatetime } from '../../utils';
|
|
4
4
|
import type { TFormatterFn } from './types';
|
|
5
5
|
import { useCandleData } from './useCandleData';
|
|
6
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
6
7
|
|
|
7
8
|
export function useCandlestickChartDatetime({
|
|
8
9
|
format,
|
|
@@ -13,8 +14,8 @@ export function useCandlestickChartDatetime({
|
|
|
13
14
|
locale?: string;
|
|
14
15
|
options?: { [key: string]: string };
|
|
15
16
|
} = {}): {
|
|
16
|
-
value: Readonly<
|
|
17
|
-
formatted: Readonly<
|
|
17
|
+
value: Readonly<SharedValue<string>>;
|
|
18
|
+
formatted: Readonly<SharedValue<string>>;
|
|
18
19
|
} {
|
|
19
20
|
const candle = useCandleData();
|
|
20
21
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useDerivedValue } from 'react-native-reanimated';
|
|
2
2
|
|
|
3
3
|
import { formatPrice } from '../../utils';
|
|
4
4
|
import { useCandlestickChart } from './useCandlestickChart';
|
|
5
5
|
import { getPrice } from './utils';
|
|
6
6
|
import type { TFormatterFn, TPriceType } from './types';
|
|
7
7
|
import { useCandleData } from './useCandleData';
|
|
8
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
8
9
|
|
|
9
10
|
export function useCandlestickChartPrice({
|
|
10
11
|
format,
|
|
@@ -15,8 +16,8 @@ export function useCandlestickChartPrice({
|
|
|
15
16
|
precision?: number;
|
|
16
17
|
type?: TPriceType;
|
|
17
18
|
} = {}): {
|
|
18
|
-
value: Readonly<
|
|
19
|
-
formatted: Readonly<
|
|
19
|
+
value: Readonly<SharedValue<string>>;
|
|
20
|
+
formatted: Readonly<SharedValue<string>>;
|
|
20
21
|
} {
|
|
21
22
|
const { currentY, domain, height } = useCandlestickChart();
|
|
22
23
|
const candle = useCandleData();
|
|
@@ -55,11 +55,11 @@ export function LineChart({
|
|
|
55
55
|
|
|
56
56
|
const pathWidth = React.useMemo(() => {
|
|
57
57
|
let allowedWidth = width;
|
|
58
|
-
if (xLength > data.length) {
|
|
58
|
+
if (data && xLength > data.length) {
|
|
59
59
|
allowedWidth = (width * data.length) / xLength;
|
|
60
60
|
}
|
|
61
61
|
return allowedWidth;
|
|
62
|
-
}, [data
|
|
62
|
+
}, [data, width, xLength]);
|
|
63
63
|
|
|
64
64
|
const path = React.useMemo(() => {
|
|
65
65
|
if (data && data.length > 0) {
|
|
@@ -91,11 +91,10 @@ export function LineChart({
|
|
|
91
91
|
return '';
|
|
92
92
|
}, [data, pathWidth, height, yGutter, shape, yDomain, xDomain]);
|
|
93
93
|
|
|
94
|
-
const dataLength = data.length;
|
|
95
94
|
const parsedPath = React.useMemo(() => parse(path), [path]);
|
|
96
95
|
const pointWidth = React.useMemo(
|
|
97
|
-
() => width / (
|
|
98
|
-
[
|
|
96
|
+
() => width / (data ? data.length - 1 : 1),
|
|
97
|
+
[data, width]
|
|
99
98
|
);
|
|
100
99
|
|
|
101
100
|
const contextValue = React.useMemo(
|
|
@@ -152,6 +152,8 @@ export function LineChartPathWrapper({
|
|
|
152
152
|
width={strokeWidth}
|
|
153
153
|
{...pathProps}
|
|
154
154
|
/>
|
|
155
|
+
</Svg>
|
|
156
|
+
<Svg style={StyleSheet.absoluteFill}>
|
|
155
157
|
{backgroundChildren}
|
|
156
158
|
</Svg>
|
|
157
159
|
</View>
|
|
@@ -166,6 +168,8 @@ export function LineChartPathWrapper({
|
|
|
166
168
|
<View style={StyleSheet.absoluteFill}>
|
|
167
169
|
<AnimatedSVG animatedProps={svgProps} height={height}>
|
|
168
170
|
<LineChartPath color={color} width={strokeWidth} {...pathProps} />
|
|
171
|
+
</AnimatedSVG>
|
|
172
|
+
<AnimatedSVG animatedProps={svgProps} height={height} style={StyleSheet.absoluteFill}>
|
|
169
173
|
{foregroundChildren}
|
|
170
174
|
</AnimatedSVG>
|
|
171
175
|
</View>
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
useAnimatedReaction,
|
|
5
5
|
useSharedValue,
|
|
6
6
|
} from 'react-native-reanimated';
|
|
7
|
-
import type { TLineChartDataProp } from './types';
|
|
7
|
+
import type { TLineChartData, TLineChartDataProp } from './types';
|
|
8
8
|
import { LineChartDataProvider } from './Data';
|
|
9
9
|
|
|
10
10
|
import type { TLineChartContext, YRangeProp } from './types';
|
|
11
11
|
import { getDomain, lineChartDataPropToArray } from './utils';
|
|
12
12
|
|
|
13
13
|
export const LineChartContext = React.createContext<TLineChartContext>({
|
|
14
|
-
currentX: { value: -1 },
|
|
15
|
-
currentIndex: { value: -1 },
|
|
14
|
+
currentX: { value: -1 } as TLineChartContext['currentX'],
|
|
15
|
+
currentIndex: { value: -1 } as TLineChartContext['currentIndex'],
|
|
16
16
|
domain: [0, 0],
|
|
17
|
-
isActive: { value: false },
|
|
17
|
+
isActive: { value: false } as TLineChartContext['isActive'],
|
|
18
18
|
yDomain: {
|
|
19
19
|
min: 0,
|
|
20
20
|
max: 0,
|
|
@@ -47,12 +47,16 @@ export function LineChartProvider({
|
|
|
47
47
|
const isActive = useSharedValue(false);
|
|
48
48
|
|
|
49
49
|
const domain = React.useMemo(
|
|
50
|
-
() => getDomain(
|
|
50
|
+
() => getDomain(
|
|
51
|
+
Array.isArray(data) ? data : Object.values(data)[0] as TLineChartData
|
|
52
|
+
),
|
|
51
53
|
[data]
|
|
52
54
|
);
|
|
53
55
|
|
|
54
56
|
const contextValue = React.useMemo<TLineChartContext>(() => {
|
|
55
57
|
const values = lineChartDataPropToArray(data).map(({ value }) => value);
|
|
58
|
+
const domainRows =
|
|
59
|
+
Array.isArray(data) ? data : Object.values(data)[0] as TLineChartData;
|
|
56
60
|
|
|
57
61
|
return {
|
|
58
62
|
currentX,
|
|
@@ -64,8 +68,7 @@ export function LineChartProvider({
|
|
|
64
68
|
max: yRange?.max ?? Math.max(...values),
|
|
65
69
|
},
|
|
66
70
|
xDomain,
|
|
67
|
-
xLength:
|
|
68
|
-
xLength ?? (Array.isArray(data) ? data : Object.values(data)[0]).length,
|
|
71
|
+
xLength: xLength ?? domainRows.length,
|
|
69
72
|
};
|
|
70
73
|
}, [
|
|
71
74
|
currentIndex,
|
|
@@ -39,7 +39,7 @@ export function LineChartCursor({
|
|
|
39
39
|
);
|
|
40
40
|
const { currentX, currentIndex, isActive, data, xDomain } = useLineChart();
|
|
41
41
|
const xValues = React.useMemo(
|
|
42
|
-
() => data.map(({ timestamp }, i) => (xDomain ? timestamp : i)),
|
|
42
|
+
() => (data ?? []).map(({ timestamp }, i) => (xDomain ? timestamp : i)),
|
|
43
43
|
[data, xDomain]
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -70,7 +70,7 @@ export function LineChartCursor({
|
|
|
70
70
|
|
|
71
71
|
const newXPosition = (
|
|
72
72
|
closestIndex > 0
|
|
73
|
-
? parsedPath.curves[closestPathCurve]
|
|
73
|
+
? parsedPath.curves[closestPathCurve]!.to
|
|
74
74
|
: parsedPath.move
|
|
75
75
|
).x;
|
|
76
76
|
// Update values
|
|
@@ -92,7 +92,7 @@ export function LineChartCursor({
|
|
|
92
92
|
const minIndex = 0;
|
|
93
93
|
const boundedIndex = Math.max(
|
|
94
94
|
minIndex,
|
|
95
|
-
Math.round(xPosition / width / (1 / (data.length - 1)))
|
|
95
|
+
Math.round(xPosition / width / (1 / (data ? data.length - 1 : 1)))
|
|
96
96
|
);
|
|
97
97
|
|
|
98
98
|
if (snapToPoint) {
|
package/src/charts/line/Data.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TLineChartData } from './types';
|
|
2
|
-
import
|
|
2
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
import type { TLineChartDataProp } from './types';
|
|
5
5
|
|
package/src/charts/line/Dot.tsx
CHANGED
|
@@ -113,6 +113,7 @@ export function LineChartDot({
|
|
|
113
113
|
const easing = Easing.out(Easing.sin);
|
|
114
114
|
const animatedOpacity = withRepeat(
|
|
115
115
|
withSequence(
|
|
116
|
+
withTiming(0),
|
|
116
117
|
withTiming(0.8),
|
|
117
118
|
withTiming(0, {
|
|
118
119
|
duration: pulseDurationMs,
|
|
@@ -124,6 +125,7 @@ export function LineChartDot({
|
|
|
124
125
|
);
|
|
125
126
|
const scale = withRepeat(
|
|
126
127
|
withSequence(
|
|
128
|
+
withTiming(0),
|
|
127
129
|
withTiming(0),
|
|
128
130
|
withTiming(outerSize, {
|
|
129
131
|
duration: pulseDurationMs,
|
|
@@ -65,7 +65,7 @@ export const LineChartHoverTrap = () => {
|
|
|
65
65
|
const minIndex = 0;
|
|
66
66
|
const boundedIndex = Math.max(
|
|
67
67
|
minIndex,
|
|
68
|
-
Math.round(boundedX / width / (1 / (data.length - 1)))
|
|
68
|
+
Math.round(boundedX / width / (1 / (data ? data.length - 1 : 1)))
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
currentIndex.value = boundedIndex;
|
|
@@ -75,7 +75,7 @@ export const LineChartHoverTrap = () => {
|
|
|
75
75
|
currentIndex.value = -1;
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
[currentIndex, currentX, data
|
|
78
|
+
[currentIndex, currentX, data, isActive, parsedPath, width]
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
const onMouseLeave = React.useCallback(() => {
|
package/src/charts/line/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
2
2
|
|
|
3
3
|
export type TLineChartPoint = {
|
|
4
4
|
timestamp: number;
|
|
@@ -12,9 +12,9 @@ export type TLineChartDataProp =
|
|
|
12
12
|
export type TLineChartData = Array<TLineChartPoint>;
|
|
13
13
|
export type TLineChartDomain = [number, number];
|
|
14
14
|
export type TLineChartContext = {
|
|
15
|
-
currentX:
|
|
16
|
-
currentIndex:
|
|
17
|
-
isActive:
|
|
15
|
+
currentX: SharedValue<number>;
|
|
16
|
+
currentIndex: SharedValue<number>;
|
|
17
|
+
isActive: SharedValue<boolean>;
|
|
18
18
|
domain: TLineChartDomain;
|
|
19
19
|
yDomain: YDomain;
|
|
20
20
|
xLength: number;
|
|
@@ -16,9 +16,14 @@ export function useLineChartDatetime({
|
|
|
16
16
|
const { currentIndex, data } = useLineChart();
|
|
17
17
|
|
|
18
18
|
const timestamp = useDerivedValue(() => {
|
|
19
|
-
if (
|
|
19
|
+
if (
|
|
20
|
+
!data ||
|
|
21
|
+
typeof currentIndex.value === 'undefined' ||
|
|
22
|
+
currentIndex.value === -1
|
|
23
|
+
) {
|
|
20
24
|
return '';
|
|
21
|
-
|
|
25
|
+
}
|
|
26
|
+
return data[currentIndex.value]?.timestamp ?? '';
|
|
22
27
|
}, [currentIndex, data]);
|
|
23
28
|
|
|
24
29
|
const timestampString = useDerivedValue(() => {
|
|
@@ -12,14 +12,20 @@ export function useLineChartPrice({
|
|
|
12
12
|
const { currentIndex, data } = useLineChart();
|
|
13
13
|
|
|
14
14
|
const float = useDerivedValue(() => {
|
|
15
|
+
if (!data) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
if (
|
|
16
20
|
(typeof currentIndex.value === 'undefined' ||
|
|
17
21
|
currentIndex.value === -1) &&
|
|
18
22
|
index == null
|
|
19
|
-
)
|
|
23
|
+
) {
|
|
20
24
|
return '';
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
let price = 0;
|
|
22
|
-
price = data[Math.min(index ?? currentIndex.value, data.length - 1)]
|
|
28
|
+
price = data[Math.min(index ?? currentIndex.value, data.length - 1)]!.value;
|
|
23
29
|
return price.toFixed(precision).toString();
|
|
24
30
|
}, [currentIndex, data, precision]);
|
|
25
31
|
const formatted = useDerivedValue(() => {
|
|
@@ -33,7 +33,7 @@ export function getArea({
|
|
|
33
33
|
.range([height - gutter, gutter]);
|
|
34
34
|
const area = shape
|
|
35
35
|
.area()
|
|
36
|
-
.x((_: unknown, i: number) => scaleX(xDomain ? timestamps[i] : i))
|
|
36
|
+
.x((_: unknown, i: number) => scaleX(xDomain ? timestamps[i] ?? i : i))
|
|
37
37
|
.y0((d: { value: unknown }) => scaleY(d.value as number))
|
|
38
38
|
.y1(() => height)
|
|
39
39
|
.curve(_shape)(data);
|
|
@@ -43,7 +43,7 @@ export function getPath({
|
|
|
43
43
|
.find((item) => item.timestamp === d.timestamp)
|
|
44
44
|
: true
|
|
45
45
|
)
|
|
46
|
-
.x((_: unknown, i: number) => scaleX(xDomain ? timestamps[i] : i))
|
|
46
|
+
.x((_: unknown, i: number) => scaleX(xDomain ? timestamps[i] ?? i : i))
|
|
47
47
|
.y((d: { value: number }) => scaleY(d.value))
|
|
48
48
|
.curve(_shape)(data);
|
|
49
49
|
return path;
|
|
@@ -5,5 +5,15 @@ export function getXPositionForCurve(path: Path, index: number) {
|
|
|
5
5
|
if (index === 0) {
|
|
6
6
|
return path.move.x;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
const point = path.curves[index - 1];
|
|
10
|
+
|
|
11
|
+
if (point === undefined) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
`Index out of bounds: ${index}. ` +
|
|
14
|
+
`Expected an integer in the range [0, ${path.curves.length}]`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return point.to.x;
|
|
9
19
|
}
|
|
@@ -7,12 +7,12 @@ import Animated, {
|
|
|
7
7
|
useAnimatedProps,
|
|
8
8
|
useAnimatedReaction,
|
|
9
9
|
} from 'react-native-reanimated';
|
|
10
|
-
|
|
10
|
+
import type { SharedValue, AnimatedProps } from 'react-native-reanimated';
|
|
11
11
|
Animated.addWhitelistedNativeProps({ text: true });
|
|
12
12
|
|
|
13
13
|
interface AnimatedTextProps {
|
|
14
|
-
text:
|
|
15
|
-
style?:
|
|
14
|
+
text: SharedValue<string>;
|
|
15
|
+
style?: AnimatedProps<RNTextProps>['style'];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
|
package/src/utils/formatPrice.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function formatPrice({
|
|
|
31
31
|
let res = `${Number(value).toFixed(decimals)}`;
|
|
32
32
|
const vals = res.split('.');
|
|
33
33
|
if (vals.length > 0) {
|
|
34
|
-
res = vals[0]
|
|
34
|
+
res = vals[0]!.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
35
35
|
if (vals.length === 2) {
|
|
36
36
|
return res + '.' + vals[1];
|
|
37
37
|
}
|
package/.DS_Store
DELETED
|
Binary file
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
[*]
|
|
8
|
-
|
|
9
|
-
indent_style = space
|
|
10
|
-
indent_size = 2
|
|
11
|
-
|
|
12
|
-
end_of_line = lf
|
|
13
|
-
charset = utf-8
|
|
14
|
-
trim_trailing_whitespace = true
|
|
15
|
-
insert_final_newline = true
|
package/.gitattributes
DELETED
package/.gitignore
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# OSX
|
|
2
|
-
#
|
|
3
|
-
.DS_Store
|
|
4
|
-
|
|
5
|
-
# XDE
|
|
6
|
-
.expo/
|
|
7
|
-
|
|
8
|
-
# VSCode
|
|
9
|
-
.vscode/
|
|
10
|
-
jsconfig.json
|
|
11
|
-
|
|
12
|
-
# Xcode
|
|
13
|
-
#
|
|
14
|
-
build/
|
|
15
|
-
*.pbxuser
|
|
16
|
-
!default.pbxuser
|
|
17
|
-
*.mode1v3
|
|
18
|
-
!default.mode1v3
|
|
19
|
-
*.mode2v3
|
|
20
|
-
!default.mode2v3
|
|
21
|
-
*.perspectivev3
|
|
22
|
-
!default.perspectivev3
|
|
23
|
-
xcuserdata
|
|
24
|
-
*.xccheckout
|
|
25
|
-
*.moved-aside
|
|
26
|
-
DerivedData
|
|
27
|
-
*.hmap
|
|
28
|
-
*.ipa
|
|
29
|
-
*.xcuserstate
|
|
30
|
-
project.xcworkspace
|
|
31
|
-
|
|
32
|
-
# Android/IJ
|
|
33
|
-
#
|
|
34
|
-
.idea
|
|
35
|
-
.gradle
|
|
36
|
-
local.properties
|
|
37
|
-
android.iml
|
|
38
|
-
|
|
39
|
-
# Cocoapods
|
|
40
|
-
#
|
|
41
|
-
example/ios/Pods
|
|
42
|
-
|
|
43
|
-
# node.js
|
|
44
|
-
#
|
|
45
|
-
node_modules/
|
|
46
|
-
npm-debug.log
|
|
47
|
-
yarn-debug.log
|
|
48
|
-
yarn-error.log
|
|
49
|
-
|
|
50
|
-
# BUCK
|
|
51
|
-
buck-out/
|
|
52
|
-
\.buckd/
|
|
53
|
-
android/app/libs
|
|
54
|
-
android/keystores/debug.keystore
|
|
55
|
-
|
|
56
|
-
# Expo
|
|
57
|
-
.expo/*
|
|
58
|
-
|
|
59
|
-
# generated by bob
|
|
60
|
-
lib/
|
package/.husky/pre-commit
DELETED
package/.prettierrc.js
DELETED
package/.yarnrc
DELETED
package/babel.config.js
DELETED
package/example/.expo/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
> Why do I have a folder named ".expo" in my project?
|
|
2
|
-
The ".expo" folder is created when an Expo project is started using "expo start" command.
|
|
3
|
-
> What do the files contain?
|
|
4
|
-
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
|
|
5
|
-
- "settings.json": contains the server configuration that is used to serve the application manifest.
|
|
6
|
-
> Should I commit the ".expo" folder?
|
|
7
|
-
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
|
|
8
|
-
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
|
package/example/README.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# react-native-wagmi-charts Example Project 🧑🏫
|
|
2
|
-
|
|
3
|
-
## Getting Started
|
|
4
|
-
|
|
5
|
-
First install project dependencies in this directory (`yarn` is recommended):
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
yarn install
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
After dependencies are installed, you can go ahead and run the project on either a simulator, or a real device using the following commands
|
|
12
|
-
|
|
13
|
-
For iOS:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
yarn run ios
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
For Android:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
yarn run android
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
For Web:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
yarn run web
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## Example Charts
|
|
33
|
-
|
|
34
|
-
The following charts are included:
|
|
35
|
-
|
|
36
|
-
- Candlestick Chart
|
|
37
|
-
- Line Chart
|
|
38
|
-
|
|
39
|
-
### Sample Data
|
|
40
|
-
|
|
41
|
-
The charts in this example use hardcoded data, which is stored in the `src/data` directory
|
package/example/app.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native-wagmi-charts-example",
|
|
3
|
-
"displayName": "CandlestickChart Example",
|
|
4
|
-
"expo": {
|
|
5
|
-
"name": "react-native-wagmi-charts-example",
|
|
6
|
-
"slug": "react-native-wagmi-charts-example",
|
|
7
|
-
"description": "Example app for react-native-wagmi-charts",
|
|
8
|
-
"privacy": "public",
|
|
9
|
-
"version": "1.0.0",
|
|
10
|
-
"platforms": [
|
|
11
|
-
"ios",
|
|
12
|
-
"android",
|
|
13
|
-
"web"
|
|
14
|
-
],
|
|
15
|
-
"ios": {
|
|
16
|
-
"supportsTablet": true
|
|
17
|
-
},
|
|
18
|
-
"assetBundlePatterns": [
|
|
19
|
-
"**/*"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
package/example/babel.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const pkg = require('../package.json');
|
|
3
|
-
|
|
4
|
-
module.exports = function (api) {
|
|
5
|
-
api.cache(true);
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
presets: ['babel-preset-expo'],
|
|
9
|
-
plugins: [
|
|
10
|
-
[
|
|
11
|
-
'module-resolver',
|
|
12
|
-
{
|
|
13
|
-
extensions: ['.tsx', '.ts', '.js', '.json'],
|
|
14
|
-
alias: {
|
|
15
|
-
// For development, we want to alias the library to the source
|
|
16
|
-
[pkg.name]: path.join(__dirname, '..', pkg.source),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
'react-native-reanimated/plugin',
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
};
|
package/example/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { registerRootComponent } from 'expo';
|
|
2
|
-
|
|
3
|
-
import App from './src/App';
|
|
4
|
-
|
|
5
|
-
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
|
6
|
-
// It also ensures that whether you load the app in the Expo client or in a native build,
|
|
7
|
-
// the environment is set up appropriately
|
|
8
|
-
registerRootComponent(App);
|
package/example/metro.config.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const blacklist = require('metro-config/src/defaults/exclusionList');
|
|
3
|
-
const escape = require('escape-string-regexp');
|
|
4
|
-
const pak = require('../package.json');
|
|
5
|
-
|
|
6
|
-
const root = path.resolve(__dirname, '..');
|
|
7
|
-
|
|
8
|
-
const modules = Object.keys({
|
|
9
|
-
...pak.peerDependencies,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
projectRoot: __dirname,
|
|
14
|
-
watchFolders: [root],
|
|
15
|
-
|
|
16
|
-
// We need to make sure that only one version is loaded for peerDependencies
|
|
17
|
-
// So we blacklist them at the root, and alias them to the versions in example's node_modules
|
|
18
|
-
resolver: {
|
|
19
|
-
blacklistRE: blacklist(
|
|
20
|
-
modules.map(
|
|
21
|
-
(m) =>
|
|
22
|
-
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
|
|
23
|
-
)
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
extraNodeModules: modules.reduce((acc, name) => {
|
|
27
|
-
acc[name] = path.join(__dirname, 'node_modules', name);
|
|
28
|
-
return acc;
|
|
29
|
-
}, {}),
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
transformer: {
|
|
33
|
-
getTransformOptions: async () => ({
|
|
34
|
-
transform: {
|
|
35
|
-
experimentalImportSupport: false,
|
|
36
|
-
inlineRequires: true,
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
40
|
-
};
|