react-native-wagmi-charts
Version:
A sweet candlestick chart for React Native
20 lines (19 loc) • 554 B
JavaScript
import { useDerivedValue } from 'react-native-reanimated';
import { useCandlestickChart } from './useCandlestickChart';
export function useCandleData() {
const { currentX, data, step } = useCandlestickChart();
const candle = useDerivedValue(() => {
if (currentX.value === -1) {
return {
timestamp: -1,
low: -1,
open: -1,
high: -1,
close: -1,
};
}
return data[Math.floor(currentX.value / step)];
}, [currentX, data, step]);
return candle;
}
//# sourceMappingURL=useCandleData.js.map