react-native-gifted-charts 1.4.22 → 1.4.23

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.
@@ -28,7 +28,7 @@ var Animated2DWithGradient = function (props) {
28
28
  var _a;
29
29
  var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, barWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation, barMarginBottom = props.barMarginBottom, barInnerComponent = props.barInnerComponent, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, commonStyleForBar = props.commonStyleForBar, barStyleWithBackground = props.barStyleWithBackground, yAxisOffset = props.yAxisOffset;
30
30
  var _b = __read(useState(noAnimation ? props.height : 0.2), 2), height = _b[0], setHeight = _b[1];
31
- var _c = __read(useState(noAnimation ? false : true), 2), initialRender = _c[0], setInitialRender = _c[1];
31
+ var _c = __read(useState(!noAnimation), 2), initialRender = _c[0], setInitialRender = _c[1];
32
32
  useEffect(function () {
33
33
  if (!noAnimation) {
34
34
  if (initialRender) {
@@ -25,10 +25,10 @@ var RenderBars = function (props) {
25
25
  ? negativeStepHeight / negativeStepValue
26
26
  : stepHeight / stepValue;
27
27
  var barHeight = Math.max(minHeight, Math.abs(item.value) * heightFactor - xAxisThickness);
28
- var _h = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _h.commonStyleForBar, barStyleWithBackground = _h.barStyleWithBackground, commonPropsFor2Dand3Dbars = _h.commonPropsFor2Dand3Dbars, isFocused = _h.isFocused, focusedBarConfig = _h.focusedBarConfig, localFrontColor = _h.localFrontColor;
28
+ var _h = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _h.commonStyleForBar, barStyleWithBackground = _h.barStyleWithBackground, commonPropsFor2dAnd3dBars = _h.commonPropsFor2dAnd3dBars, isFocused = _h.isFocused, focusedBarConfig = _h.focusedBarConfig, localFrontColor = _h.localFrontColor;
29
29
  var itemOrPropsBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
30
30
  var localBarInnerComponent = isFocused
31
- ? (_b = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _b !== void 0 ? _b : itemOrPropsBarInnerComponent
31
+ ? ((_b = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _b !== void 0 ? _b : itemOrPropsBarInnerComponent)
32
32
  : itemOrPropsBarInnerComponent;
33
33
  var barMarginBottom = item.barMarginBottom === 0
34
34
  ? 0
@@ -149,7 +149,7 @@ var RenderBars = function (props) {
149
149
  var localGradientColor = item.gradientColor || props.gradientColor || 'white';
150
150
  return (_jsxs(_Fragment, { children: [_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, colors: [
151
151
  isFocused
152
- ? (_a = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.gradientColor) !== null && _a !== void 0 ? _a : localGradientColor
152
+ ? ((_a = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.gradientColor) !== null && _a !== void 0 ? _a : localGradientColor)
153
153
  : localGradientColor,
154
154
  localFrontColor,
155
155
  ], children: props.cappedBars && item.value ? (_jsx(Cap, { capThicknessFromItem: item.capThickness, capThicknessFromProps: props.capThickness, capColorFromItem: item.capColor, capColorFromProps: props.capColor, capRadiusFromItem: item.capRadius, capRadiusFromProps: props.capRadius })) : null }), (item.barBackgroundPattern || props.barBackgroundPattern) && (_jsx(BarBackgroundPattern, { barBackgroundPatternFromItem: item.barBackgroundPattern, barBackgroundPatternFromProps: props.barBackgroundPattern, patternIdFromItem: item.patternId, patternIdFromProps: props.patternId })), (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
@@ -173,7 +173,7 @@ var RenderBars = function (props) {
173
173
  {
174
174
  // overflow: 'visible',
175
175
  marginBottom: 60 + barMarginBottom + xAxisLabelsVerticalShift - 0.5,
176
- width: commonPropsFor2Dand3Dbars.barWidth,
176
+ width: commonPropsFor2dAnd3dBars.barWidth,
177
177
  height: barHeight,
178
178
  marginRight: spacing,
179
179
  },
@@ -204,7 +204,7 @@ var RenderBars = function (props) {
204
204
  (pointerConfig && pointerConfig.barTouchable !== true);
205
205
  var barContent = function () {
206
206
  var isBarBelowXaxisAndInvisible = item.value < 0 && !noOfSectionsBelowXAxis;
207
- var animated2DWithGradient = function (noGradient, noAnimation) { return (_jsx(Animated2DWithGradient, __assign({}, commonPropsFor2Dand3Dbars, { animationDuration: animationDuration || 800, roundedBottom: props.roundedBottom || false, roundedTop: props.roundedTop || false, noGradient: noGradient, noAnimation: noAnimation, containerHeight: containerHeight, maxValue: maxValue, minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : 0, barMarginBottom: barMarginBottom, cappedBars: props.cappedBars, capThickness: props.capThickness, capColor: props.capColor, capRadius: props.capRadius, horizontal: horizontal, barBorderWidth: barBorderWidth, barBorderColor: barBorderColor, commonStyleForBar: commonStyleForBar, barStyleWithBackground: barStyleWithBackground }))); };
207
+ var animated2DWithGradient = function (noGradient, noAnimation) { return (_jsx(Animated2DWithGradient, __assign({}, commonPropsFor2dAnd3dBars, { animationDuration: animationDuration || 800, roundedBottom: props.roundedBottom || false, roundedTop: props.roundedTop || false, noGradient: noGradient, noAnimation: noAnimation, containerHeight: containerHeight, maxValue: maxValue, minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : 0, barMarginBottom: barMarginBottom, cappedBars: props.cappedBars, capThickness: props.capThickness, capColor: props.capColor, capRadius: props.capRadius, horizontal: horizontal, barBorderWidth: barBorderWidth, barBorderColor: barBorderColor, commonStyleForBar: commonStyleForBar, barStyleWithBackground: barStyleWithBackground }))); };
208
208
  return (_jsxs(_Fragment, { children: [(props.showXAxisIndices || item.showXAxisIndex) && (_jsx(View, { style: {
209
209
  zIndex: 2,
210
210
  position: 'absolute',
@@ -213,7 +213,7 @@ var RenderBars = function (props) {
213
213
  bottom: props.xAxisIndicesHeight / -2,
214
214
  left: ((item.barWidth || barWidth) - props.xAxisIndicesWidth) / 2,
215
215
  backgroundColor: props.xAxisIndicesColor,
216
- } })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({}, commonPropsFor2Dand3Dbars, { sideWidth: item.sideWidth ||
216
+ } })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({}, commonPropsFor2dAnd3dBars, { sideWidth: item.sideWidth ||
217
217
  props.sideWidth ||
218
218
  (item.barWidth || barWidth) / 2, side: side || 'left', sideColor: item.sideColor || props.sideColor || '', topColor: item.topColor || props.topColor || '', horizontal: horizontal, isAnimated: isAnimated, animationDuration: animationDuration || 800, selectedIndex: selectedIndex }))) : item.showGradient || props.showGradient ? (isAnimated ? (animated2DWithGradient(false, false)) : (static2DWithGradient(item))) : isAnimated ? (animated2DWithGradient(true, false)) : (animated2DWithGradient(true, true)), isAnimated
219
219
  ? renderAnimatedLabel(false, label, labelTextStyle, item.value)
@@ -23,7 +23,7 @@ if (Platform.OS === 'android') {
23
23
  var RenderStackBars = function (props) {
24
24
  var _a;
25
25
  var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, item = props.item, index = props.index, containerHeight = props.containerHeight, spacing = props.spacing, rotateLabel = props.rotateLabel, label = props.label, labelTextStyle = props.labelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, activeOpacity = props.activeOpacity, _b = props.animationDuration, animationDuration = _b === void 0 ? BarDefaults.animationDuration : _b, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, stackBorderRadius = props.stackBorderRadius, stackBorderTopLeftRadius = props.stackBorderTopLeftRadius, stackBorderTopRightRadius = props.stackBorderTopRightRadius, stackBorderBottomLeftRadius = props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius = props.stackBorderBottomRightRadius, showValuesAsTopLabel = props.showValuesAsTopLabel, _c = props.autoShiftLabelsForNegativeStacks, autoShiftLabelsForNegativeStacks = _c === void 0 ? true : _c, _d = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _d === void 0 ? 0 : _d, horizontal = props.horizontal;
26
- var _e = useRenderStackBars(props), cotainsNegative = _e.cotainsNegative, noAnimation = _e.noAnimation, localBarInnerComponent = _e.localBarInnerComponent, borderRadius = _e.borderRadius, borderTopLeftRadius = _e.borderTopLeftRadius, borderTopRightRadius = _e.borderTopRightRadius, borderBottomLeftRadius = _e.borderBottomLeftRadius, borderBottomRightRadius = _e.borderBottomRightRadius, disablePress = _e.disablePress, totalHeight = _e.totalHeight, height = _e.height, setHeight = _e.setHeight, getBarHeight = _e.getBarHeight, getPosition = _e.getPosition, lowestBarPosition = _e.lowestBarPosition, getStackBorderRadii = _e.getStackBorderRadii, tooltipProps = _e.tooltipProps;
26
+ var _e = useRenderStackBars(props), containsNegativeValue = _e.containsNegativeValue, noAnimation = _e.noAnimation, localBarInnerComponent = _e.localBarInnerComponent, borderRadius = _e.borderRadius, borderTopLeftRadius = _e.borderTopLeftRadius, borderTopRightRadius = _e.borderTopRightRadius, borderBottomLeftRadius = _e.borderBottomLeftRadius, borderBottomRightRadius = _e.borderBottomRightRadius, disablePress = _e.disablePress, totalHeight = _e.totalHeight, height = _e.height, setHeight = _e.setHeight, getBarHeight = _e.getBarHeight, getPosition = _e.getPosition, lowestBarPosition = _e.lowestBarPosition, getStackBorderRadii = _e.getStackBorderRadii, tooltipProps = _e.tooltipProps;
27
27
  var renderLabel = function (label, labelTextStyle) {
28
28
  return (_jsx(View, { style: [
29
29
  {
@@ -114,7 +114,7 @@ var RenderStackBars = function (props) {
114
114
  : barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "transparent", x: "1", y: "1", width: "100%", height: "100%", fill: "url(#".concat(item.patternId || patternId, ")") })] }))] }), localBarInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: localBarInnerComponent(item, index) })) : null, (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
115
115
  {
116
116
  position: 'absolute',
117
- top: cotainsNegative
117
+ top: containsNegativeValue
118
118
  ? 0
119
119
  : (item.barWidth || props.barWidth || 30) * -1,
120
120
  height: item.barWidth || props.barWidth || 30,
@@ -122,7 +122,9 @@ var RenderStackBars = function (props) {
122
122
  justifyContent: 'center',
123
123
  alignItems: 'center',
124
124
  },
125
- cotainsNegative && { transform: [{ translateY: totalHeight * 2 }] },
125
+ containsNegativeValue && {
126
+ transform: [{ translateY: totalHeight * 2 }],
127
+ },
126
128
  horizontal &&
127
129
  !props.intactTopLabel && { transform: [{ rotate: '270deg' }] },
128
130
  item.topLabelContainerStyle,
@@ -138,7 +140,7 @@ var RenderStackBars = function (props) {
138
140
  }, children: static2DSimple() }));
139
141
  };
140
142
  return (_jsxs(_Fragment, { children: [_jsxs(View, { pointerEvents: props.pointerConfig
141
- ? (_a = props.pointerConfig.pointerEvents) !== null && _a !== void 0 ? _a : 'none'
143
+ ? ((_a = props.pointerConfig.pointerEvents) !== null && _a !== void 0 ? _a : 'none')
142
144
  : 'auto', style: [
143
145
  {
144
146
  // overflow: 'visible',
@@ -22,7 +22,7 @@ import { screenWidth } from '../utils';
22
22
  export var BarChart = function (props) {
23
23
  var _a, _b;
24
24
  var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
25
- var opacValue = useMemo(function () { return new Animated.Value(0); }, []);
25
+ var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
26
26
  var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
27
27
  var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
28
28
  var remainingScrollViewProps = {
@@ -33,16 +33,16 @@ export var BarChart = function (props) {
33
33
  }
34
34
  },
35
35
  };
36
- var _c = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacValue: opacValue, parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), lineConfig = _c.lineConfig, hidePointer1 = _c.hidePointer1, pointerItem = _c.pointerItem, pointerY = _c.pointerY, pointerConfig = _c.pointerConfig, pointerColor = _c.pointerColor, pointerX = _c.pointerX, pointerComponent = _c.pointerComponent, pointerHeight = _c.pointerHeight, pointerRadius = _c.pointerRadius, pointerWidth = _c.pointerWidth, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerLabelWidth = _c.pointerLabelWidth, activatePointersOnLongPress = _c.activatePointersOnLongPress, yAxisLabelWidth = _c.yAxisLabelWidth, shiftPointerLabelX = _c.shiftPointerLabelX, pointerLabelHeight = _c.pointerLabelHeight, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerStripHeight = _c.pointerStripHeight, shiftPointerLabelY = _c.shiftPointerLabelY, showPointerStrip = _c.showPointerStrip, pointerStripWidth = _c.pointerStripWidth, containerHeight = _c.containerHeight, xAxisThickness = _c.xAxisThickness, pointerStripColor = _c.pointerStripColor, pointerEvents = _c.pointerEvents, setResponderStartTime = _c.setResponderStartTime, setPointerY = _c.setPointerY, setPointerItem = _c.setPointerItem, initialSpacing = _c.initialSpacing, spacing = _c.spacing, data = _c.data, barWidth = _c.barWidth, setPointerX = _c.setPointerX, setPointerIndex = _c.setPointerIndex, maxValue = _c.maxValue, responderStartTime = _c.responderStartTime, setResponderActive = _c.setResponderActive, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, pointerVanishDelay = _c.pointerVanishDelay, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, extendedContainerHeight = _c.extendedContainerHeight, totalWidth = _c.totalWidth, stripBehindBars = _c.stripBehindBars, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, stepHeight = _c.stepHeight, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, labelsExtraHeight = _c.labelsExtraHeight, stripOverPointer = _c.stripOverPointer, pointerLabelComponent = _c.pointerLabelComponent, setSelectedIndex = _c.setSelectedIndex, isAnimated = _c.isAnimated, animationDuration = _c.animationDuration, side = _c.side, labelWidth = _c.labelWidth, isThreeD = _c.isThreeD, animatedHeight = _c.animatedHeight, appearingOpacity = _c.appearingOpacity, autoShiftLabels = _c.autoShiftLabels, getPropsCommonForBarAndStack = _c.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _c.autoShiftLabelsForNegativeStacks;
36
+ var _c = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacityValue: opacityValue, parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), lineConfig = _c.lineConfig, hidePointer1 = _c.hidePointer1, pointerItem = _c.pointerItem, pointerY = _c.pointerY, pointerConfig = _c.pointerConfig, pointerColor = _c.pointerColor, pointerX = _c.pointerX, pointerComponent = _c.pointerComponent, pointerHeight = _c.pointerHeight, pointerRadius = _c.pointerRadius, pointerWidth = _c.pointerWidth, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerLabelWidth = _c.pointerLabelWidth, activatePointersOnLongPress = _c.activatePointersOnLongPress, yAxisLabelWidth = _c.yAxisLabelWidth, shiftPointerLabelX = _c.shiftPointerLabelX, pointerLabelHeight = _c.pointerLabelHeight, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerStripHeight = _c.pointerStripHeight, shiftPointerLabelY = _c.shiftPointerLabelY, showPointerStrip = _c.showPointerStrip, pointerStripWidth = _c.pointerStripWidth, containerHeight = _c.containerHeight, xAxisThickness = _c.xAxisThickness, pointerStripColor = _c.pointerStripColor, pointerEvents = _c.pointerEvents, setResponderStartTime = _c.setResponderStartTime, setPointerY = _c.setPointerY, setPointerItem = _c.setPointerItem, initialSpacing = _c.initialSpacing, spacing = _c.spacing, data = _c.data, barWidth = _c.barWidth, setPointerX = _c.setPointerX, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, maxValue = _c.maxValue, responderStartTime = _c.responderStartTime, setResponderActive = _c.setResponderActive, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, pointerVanishDelay = _c.pointerVanishDelay, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, extendedContainerHeight = _c.extendedContainerHeight, totalWidth = _c.totalWidth, stripBehindBars = _c.stripBehindBars, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, stepHeight = _c.stepHeight, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, labelsExtraHeight = _c.labelsExtraHeight, stripOverPointer = _c.stripOverPointer, pointerLabelComponent = _c.pointerLabelComponent, setSelectedIndex = _c.setSelectedIndex, isAnimated = _c.isAnimated, animationDuration = _c.animationDuration, side = _c.side, labelWidth = _c.labelWidth, isThreeD = _c.isThreeD, animatedHeight = _c.animatedHeight, appearingOpacity = _c.appearingOpacity, autoShiftLabels = _c.autoShiftLabels, getPropsCommonForBarAndStack = _c.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _c.autoShiftLabelsForNegativeStacks;
37
37
  var labelsAppear = useCallback(function () {
38
- opacValue.setValue(0);
39
- Animated.timing(opacValue, {
38
+ opacityValue.setValue(0);
39
+ Animated.timing(opacityValue, {
40
40
  toValue: 1,
41
41
  duration: 500,
42
42
  easing: Easing.ease,
43
43
  useNativeDriver: false,
44
44
  }).start();
45
- }, [opacValue]);
45
+ }, [opacityValue]);
46
46
  var decreaseWidth = useCallback(function () {
47
47
  widthValue.setValue(0);
48
48
  Animated.timing(widthValue, {
@@ -103,11 +103,14 @@ export var BarChart = function (props) {
103
103
  scrollX: 0,
104
104
  pointerEvents: pointerEvents,
105
105
  isBarChart: true,
106
+ pointerIndex: pointerIndex,
107
+ width: totalWidth,
108
+ screenWidth: screenWidth,
106
109
  });
107
110
  };
108
111
  var renderChartContent = function () {
109
112
  if (pointerConfig) {
110
- return (_jsxs(View, { onStartShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onResponderGrant: function (evt) {
113
+ return (_jsxs(View, { onStartShouldSetResponder: function () { return !!pointerConfig; }, onMoveShouldSetResponder: function () { return !!pointerConfig; }, onResponderGrant: function (evt) {
111
114
  var _a;
112
115
  if (!pointerConfig)
113
116
  return;
@@ -1 +1,2 @@
1
- export declare const StripAndLabel: (props: any) => import("react/jsx-runtime").JSX.Element;
1
+ import { StripAndLabelProps } from 'gifted-charts-core';
2
+ export declare const StripAndLabel: (props: StripAndLabelProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
3
  import Svg, { Line } from 'react-native-svg';
4
- import { getTopAndLeftForStripAndLabel } from 'gifted-charts-core';
4
+ import { getTopAndLeftForStripAndLabel, } from 'gifted-charts-core';
5
5
  export var StripAndLabel = function (props) {
6
6
  var _a;
7
- var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart;
7
+ var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart, pointerIndex = props.pointerIndex;
8
8
  var _b = getTopAndLeftForStripAndLabel(props), top = _b.top, left = _b.left;
9
9
  return (_jsxs(View, { style: {
10
10
  position: 'absolute',
@@ -39,5 +39,5 @@ export var StripAndLabel = function (props) {
39
39
  : containerHeight - pointerStripHeight,
40
40
  width: pointerLabelWidth,
41
41
  },
42
- ], children: pointerLabelComponent === null || pointerLabelComponent === void 0 ? void 0 : pointerLabelComponent(pointerItemLocal, secondaryPointerItem) })) : null] }));
42
+ ], children: pointerLabelComponent === null || pointerLabelComponent === void 0 ? void 0 : pointerLabelComponent(pointerItemLocal, secondaryPointerItem, pointerIndex) })) : null] }));
43
43
  };
@@ -22,18 +22,18 @@ export var LineChartBicolor = function (props) {
22
22
  var scrollRef = useRef();
23
23
  // const heightValue = useMemo(() => new Animated.Value(0), []);
24
24
  var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
25
- var opacValue = useMemo(function () { return new Animated.Value(0); }, []);
25
+ var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
26
26
  var _b = useLineChartBiColor(__assign(__assign({}, props), { parentWidth: (_a = props.parentWidth) !== null && _a !== void 0 ? _a : screenWidth })), pointsArray = _b.pointsArray, fillPointsArray = _b.fillPointsArray, selectedIndex = _b.selectedIndex, setSelectedIndex = _b.setSelectedIndex, containerHeight = _b.containerHeight, data = _b.data, labelsExtraHeight = _b.labelsExtraHeight, animationDuration = _b.animationDuration, startIndex1 = _b.startIndex1, endIndex1 = _b.endIndex1, initialSpacing = _b.initialSpacing, thickness = _b.thickness, spacing = _b.spacing, xAxisThickness = _b.xAxisThickness, dataPointsHeight1 = _b.dataPointsHeight1, dataPointsWidth1 = _b.dataPointsWidth1, dataPointsRadius1 = _b.dataPointsRadius1, dataPointsColor1 = _b.dataPointsColor1, dataPointsShape1 = _b.dataPointsShape1, areaChart = _b.areaChart, textFontSize1 = _b.textFontSize1, textColor1 = _b.textColor1, totalWidth = _b.totalWidth, maxValue = _b.maxValue, extendedContainerHeight = _b.extendedContainerHeight, getX = _b.getX, getY = _b.getY, stepHeight = _b.stepHeight, noOfSectionsBelowXAxis = _b.noOfSectionsBelowXAxis, thickness1 = _b.thickness1, zIndex = _b.zIndex, strokeDashArray1 = _b.strokeDashArray1, rotateLabel = _b.rotateLabel, isAnimated = _b.isAnimated, hideDataPoints1 = _b.hideDataPoints1, color = _b.color, colorNegative = _b.colorNegative, startFillColor = _b.startFillColor, endFillColor = _b.endFillColor, startOpacity = _b.startOpacity, endOpacity = _b.endOpacity, startFillColorNegative = _b.startFillColorNegative, endFillColorNegative = _b.endFillColorNegative, startOpacityNegative = _b.startOpacityNegative, endOpacityNegative = _b.endOpacityNegative, gradientDirection = _b.gradientDirection, xAxisTextNumberOfLines = _b.xAxisTextNumberOfLines, focusEnabled = _b.focusEnabled, showDataPointOnFocus = _b.showDataPointOnFocus, showStripOnFocus = _b.showStripOnFocus, showTextOnFocus = _b.showTextOnFocus, stripHeight = _b.stripHeight, stripWidth = _b.stripWidth, stripColor = _b.stripColor, stripOpacity = _b.stripOpacity, unFocusOnPressOut = _b.unFocusOnPressOut, delayBeforeUnFocus = _b.delayBeforeUnFocus, barAndLineChartsWrapperProps = _b.barAndLineChartsWrapperProps;
27
27
  var labelsAppear = useCallback(function () {
28
- opacValue.setValue(0);
29
- Animated.timing(opacValue, {
28
+ opacityValue.setValue(0);
29
+ Animated.timing(opacityValue, {
30
30
  toValue: 1,
31
31
  duration: 500,
32
32
  easing: Easing.ease,
33
33
  useNativeDriver: false,
34
34
  }).start();
35
- }, [opacValue]);
36
- var appearingOpacity = opacValue.interpolate({
35
+ }, [opacityValue]);
36
+ var appearingOpacity = opacityValue.interpolate({
37
37
  inputRange: [0, 1],
38
38
  outputRange: [0, 1],
39
39
  });
@@ -36,57 +36,72 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
36
36
  };
37
37
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
38
38
  import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
39
- import { View, Animated, Easing, Text, Dimensions, Platform, I18nManager, } from 'react-native';
39
+ import { View, Animated, Easing, Text, Dimensions, I18nManager, } from 'react-native';
40
40
  import { styles } from './styles';
41
- import { screenWidth } from '../utils';
41
+ import { screenWidth, usePrevious } from '../utils';
42
42
  import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, Line, } from 'react-native-svg';
43
43
  import { getSegmentedPathObjects, getRegionPathObjects, RANGE_ENTER, RANGE_EXIT, SEGMENT_END, SEGMENT_START, STOP, useLineChart, adjustToOffset, LineDefaults, } from 'gifted-charts-core';
44
44
  import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
45
45
  import { StripAndLabel } from '../Components/common/StripAndLabel';
46
46
  import { Pointer } from '../Components/common/Pointer';
47
- var initialData = null;
48
- var animations = [];
47
+ var AnimatedPath = Animated.createAnimatedComponent(Path);
49
48
  export var LineChart = function (props) {
50
- var _a, _b, _c, _d, _e, _f;
49
+ var _a, _b;
51
50
  var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
52
- var opacValue = useMemo(function () { return new Animated.Value(0); }, []);
51
+ var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
53
52
  var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
54
53
  var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
55
54
  var widthValue2 = useMemo(function () { return new Animated.Value(0); }, []);
56
55
  var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
57
56
  var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
58
57
  var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
59
- if (!initialData) {
60
- initialData = (_e = (_d = (_c = (_b = props.dataSet) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.data) !== null && _d !== void 0 ? _d : props.data) !== null && _e !== void 0 ? _e : [];
61
- animations = initialData
62
- .filter(function (item) { return item.value; })
63
- .map(function (item) { return new Animated.Value(item.value); });
64
- }
65
- var _g = useLineChart(__assign(__assign({}, props), { animations: animations, parentWidth: (_f = props.parentWidth) !== null && _f !== void 0 ? _f : screenWidth })), scrollX = _g.scrollX, setScrollX = _g.setScrollX, arrow1Points = _g.arrow1Points, arrow2Points = _g.arrow2Points, arrow3Points = _g.arrow3Points, arrow4Points = _g.arrow4Points, arrow5Points = _g.arrow5Points, secondaryArrowPoints = _g.secondaryArrowPoints, pointerIndex = _g.pointerIndex, setPointerIndex = _g.setPointerIndex, pointerX = _g.pointerX, setPointerX = _g.setPointerX, pointerY = _g.pointerY, setPointerY = _g.setPointerY, pointerItem = _g.pointerItem, setPointerItem = _g.setPointerItem, pointerY2 = _g.pointerY2, setPointerY2 = _g.setPointerY2, pointerItem2 = _g.pointerItem2, setPointerItem2 = _g.setPointerItem2, pointerY3 = _g.pointerY3, setPointerY3 = _g.setPointerY3, pointerItem3 = _g.pointerItem3, setPointerItem3 = _g.setPointerItem3, pointerY4 = _g.pointerY4, setPointerY4 = _g.setPointerY4, pointerItem4 = _g.pointerItem4, setPointerItem4 = _g.setPointerItem4, pointerY5 = _g.pointerY5, setPointerY5 = _g.setPointerY5, pointerYsForDataSet = _g.pointerYsForDataSet, setPointerYsForDataSet = _g.setPointerYsForDataSet, pointerItem5 = _g.pointerItem5, setPointerItem5 = _g.setPointerItem5, secondaryPointerY = _g.secondaryPointerY, setSecondaryPointerY = _g.setSecondaryPointerY, secondaryPointerItem = _g.secondaryPointerItem, setSecondaryPointerItem = _g.setSecondaryPointerItem, responderStartTime = _g.responderStartTime, setResponderStartTime = _g.setResponderStartTime, setResponderActive = _g.setResponderActive, points = _g.points, points2 = _g.points2, points3 = _g.points3, points4 = _g.points4, points5 = _g.points5, secondaryPoints = _g.secondaryPoints, fillPoints = _g.fillPoints, fillPoints2 = _g.fillPoints2, fillPoints3 = _g.fillPoints3, fillPoints4 = _g.fillPoints4, fillPoints5 = _g.fillPoints5, secondaryFillPoints = _g.secondaryFillPoints, pointsFromSet = _g.pointsFromSet, fillPointsFromSet = _g.fillPointsFromSet, arrowPointsFromSet = _g.arrowPointsFromSet, selectedIndex = _g.selectedIndex, setSelectedIndex = _g.setSelectedIndex, containerHeight = _g.containerHeight, data = _g.data, data2 = _g.data2, data3 = _g.data3, data4 = _g.data4, data5 = _g.data5, secondaryData = _g.secondaryData, dataSet = _g.dataSet, data0 = _g.data0, labelsExtraHeight = _g.labelsExtraHeight, animationDuration = _g.animationDuration, onDataChangeAnimationDuration = _g.onDataChangeAnimationDuration, animateTogether = _g.animateTogether, animateOnDataChange = _g.animateOnDataChange, startIndex1 = _g.startIndex1, startIndex2 = _g.startIndex2, endIndex1 = _g.endIndex1, endIndex2 = _g.endIndex2, startIndex3 = _g.startIndex3, endIndex3 = _g.endIndex3, startIndex4 = _g.startIndex4, endIndex4 = _g.endIndex4, startIndex5 = _g.startIndex5, endIndex5 = _g.endIndex5, initialSpacing = _g.initialSpacing, thickness = _g.thickness, yAxisLabelWidth = _g.yAxisLabelWidth, spacing = _g.spacing, xAxisThickness = _g.xAxisThickness, dataPointsHeight1 = _g.dataPointsHeight1, dataPointsWidth1 = _g.dataPointsWidth1, dataPointsRadius1 = _g.dataPointsRadius1, dataPointsColor1 = _g.dataPointsColor1, dataPointsShape1 = _g.dataPointsShape1, dataPointsHeight2 = _g.dataPointsHeight2, dataPointsWidth2 = _g.dataPointsWidth2, dataPointsRadius2 = _g.dataPointsRadius2, dataPointsColor2 = _g.dataPointsColor2, dataPointsShape2 = _g.dataPointsShape2, dataPointsHeight3 = _g.dataPointsHeight3, dataPointsWidth3 = _g.dataPointsWidth3, dataPointsRadius3 = _g.dataPointsRadius3, dataPointsColor3 = _g.dataPointsColor3, dataPointsShape3 = _g.dataPointsShape3, dataPointsHeight4 = _g.dataPointsHeight4, dataPointsWidth4 = _g.dataPointsWidth4, dataPointsRadius4 = _g.dataPointsRadius4, dataPointsColor4 = _g.dataPointsColor4, dataPointsShape4 = _g.dataPointsShape4, dataPointsHeight5 = _g.dataPointsHeight5, dataPointsWidth5 = _g.dataPointsWidth5, dataPointsRadius5 = _g.dataPointsRadius5, dataPointsColor5 = _g.dataPointsColor5, dataPointsShape5 = _g.dataPointsShape5, getIsNthAreaChart = _g.getIsNthAreaChart, textFontSize1 = _g.textFontSize1, textFontSize2 = _g.textFontSize2, textFontSize3 = _g.textFontSize3, textFontSize4 = _g.textFontSize4, textFontSize5 = _g.textFontSize5, textColor1 = _g.textColor1, textColor2 = _g.textColor2, textColor3 = _g.textColor3, textColor4 = _g.textColor4, textColor5 = _g.textColor5, totalWidth = _g.totalWidth, maxValue = _g.maxValue, overflowTop = _g.overflowTop, extendedContainerHeight = _g.extendedContainerHeight, getX = _g.getX, getY = _g.getY, getSecondaryY = _g.getSecondaryY, secondaryMaxValue = _g.secondaryMaxValue, showValuesAsDataPointsText = _g.showValuesAsDataPointsText, thickness1 = _g.thickness1, thickness2 = _g.thickness2, thickness3 = _g.thickness3, thickness4 = _g.thickness4, thickness5 = _g.thickness5, zIndex1 = _g.zIndex1, zIndex2 = _g.zIndex2, zIndex3 = _g.zIndex3, zIndex4 = _g.zIndex4, zIndex5 = _g.zIndex5, strokeDashArray1 = _g.strokeDashArray1, strokeDashArray2 = _g.strokeDashArray2, strokeDashArray3 = _g.strokeDashArray3, strokeDashArray4 = _g.strokeDashArray4, strokeDashArray5 = _g.strokeDashArray5, rotateLabel = _g.rotateLabel, isAnimated = _g.isAnimated, hideDataPoints1 = _g.hideDataPoints1, hideDataPoints2 = _g.hideDataPoints2, hideDataPoints3 = _g.hideDataPoints3, hideDataPoints4 = _g.hideDataPoints4, hideDataPoints5 = _g.hideDataPoints5, color1 = _g.color1, color2 = _g.color2, color3 = _g.color3, color4 = _g.color4, color5 = _g.color5, startFillColor1 = _g.startFillColor1, endFillColor1 = _g.endFillColor1, startOpacity1 = _g.startOpacity1, endOpacity1 = _g.endOpacity1, startFillColor2 = _g.startFillColor2, endFillColor2 = _g.endFillColor2, startOpacity2 = _g.startOpacity2, endOpacity2 = _g.endOpacity2, startFillColor3 = _g.startFillColor3, endFillColor3 = _g.endFillColor3, startOpacity3 = _g.startOpacity3, endOpacity3 = _g.endOpacity3, startFillColor4 = _g.startFillColor4, endFillColor4 = _g.endFillColor4, startOpacity4 = _g.startOpacity4, endOpacity4 = _g.endOpacity4, startFillColor5 = _g.startFillColor5, endFillColor5 = _g.endFillColor5, startOpacity5 = _g.startOpacity5, endOpacity5 = _g.endOpacity5, arrowStrokeWidth1 = _g.arrowStrokeWidth1, arrowStrokeColor1 = _g.arrowStrokeColor1, arrowFillColor1 = _g.arrowFillColor1, arrowStrokeWidth2 = _g.arrowStrokeWidth2, arrowStrokeColor2 = _g.arrowStrokeColor2, arrowFillColor2 = _g.arrowFillColor2, arrowStrokeWidth3 = _g.arrowStrokeWidth3, arrowStrokeColor3 = _g.arrowStrokeColor3, arrowFillColor3 = _g.arrowFillColor3, arrowStrokeWidth4 = _g.arrowStrokeWidth4, arrowStrokeColor4 = _g.arrowStrokeColor4, arrowFillColor4 = _g.arrowFillColor4, arrowStrokeWidth5 = _g.arrowStrokeWidth5, arrowStrokeColor5 = _g.arrowStrokeColor5, arrowFillColor5 = _g.arrowFillColor5, arrowStrokeWidthsFromSet = _g.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _g.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _g.arrowFillColorsFromSet, secondaryLineConfig = _g.secondaryLineConfig, gradientDirection = _g.gradientDirection, stepHeight = _g.stepHeight, noOfSectionsBelowXAxis = _g.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _g.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _g.xAxisLabelsVerticalShift, pointerConfig = _g.pointerConfig, pointerHeight = _g.pointerHeight, pointerWidth = _g.pointerWidth, pointerRadius = _g.pointerRadius, pointerColor = _g.pointerColor, pointerComponent = _g.pointerComponent, showPointerStrip = _g.showPointerStrip, pointerStripHeight = _g.pointerStripHeight, pointerStripWidth = _g.pointerStripWidth, pointerStripColor = _g.pointerStripColor, pointerStripUptoDataPoint = _g.pointerStripUptoDataPoint, pointerLabelComponent = _g.pointerLabelComponent, stripOverPointer = _g.stripOverPointer, shiftPointerLabelX = _g.shiftPointerLabelX, shiftPointerLabelY = _g.shiftPointerLabelY, pointerLabelWidth = _g.pointerLabelWidth, pointerLabelHeight = _g.pointerLabelHeight, autoAdjustPointerLabelPosition = _g.autoAdjustPointerLabelPosition, pointerVanishDelay = _g.pointerVanishDelay, activatePointersOnLongPress = _g.activatePointersOnLongPress, activatePointersDelay = _g.activatePointersDelay, persistPointer = _g.persistPointer, hidePointer1 = _g.hidePointer1, hidePointer2 = _g.hidePointer2, hidePointer3 = _g.hidePointer3, hidePointer4 = _g.hidePointer4, hidePointer5 = _g.hidePointer5, hideSecondaryPointer = _g.hideSecondaryPointer, pointerEvents = _g.pointerEvents, focusEnabled = _g.focusEnabled, showDataPointOnFocus = _g.showDataPointOnFocus, showStripOnFocus = _g.showStripOnFocus, showTextOnFocus = _g.showTextOnFocus, showDataPointLabelOnFocus = _g.showDataPointLabelOnFocus, stripHeight = _g.stripHeight, stripWidth = _g.stripWidth, stripColor = _g.stripColor, stripOpacity = _g.stripOpacity, stripStrokeDashArray = _g.stripStrokeDashArray, unFocusOnPressOut = _g.unFocusOnPressOut, delayBeforeUnFocus = _g.delayBeforeUnFocus, containerHeightIncludingBelowXAxis = _g.containerHeightIncludingBelowXAxis, lineGradient = _g.lineGradient, lineGradientDirection = _g.lineGradientDirection, lineGradientStartColor = _g.lineGradientStartColor, lineGradientEndColor = _g.lineGradientEndColor, barAndLineChartsWrapperProps = _g.barAndLineChartsWrapperProps;
58
+ var _c = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), scrollX = _c.scrollX, setScrollX = _c.setScrollX, arrow1Points = _c.arrow1Points, arrow2Points = _c.arrow2Points, arrow3Points = _c.arrow3Points, arrow4Points = _c.arrow4Points, arrow5Points = _c.arrow5Points, secondaryArrowPoints = _c.secondaryArrowPoints, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, pointerX = _c.pointerX, setPointerX = _c.setPointerX, pointerY = _c.pointerY, setPointerY = _c.setPointerY, pointerItem = _c.pointerItem, setPointerItem = _c.setPointerItem, pointerY2 = _c.pointerY2, setPointerY2 = _c.setPointerY2, pointerItem2 = _c.pointerItem2, setPointerItem2 = _c.setPointerItem2, pointerY3 = _c.pointerY3, setPointerY3 = _c.setPointerY3, pointerItem3 = _c.pointerItem3, setPointerItem3 = _c.setPointerItem3, pointerY4 = _c.pointerY4, setPointerY4 = _c.setPointerY4, pointerItem4 = _c.pointerItem4, setPointerItem4 = _c.setPointerItem4, pointerY5 = _c.pointerY5, setPointerY5 = _c.setPointerY5, pointerYsForDataSet = _c.pointerYsForDataSet, setPointerYsForDataSet = _c.setPointerYsForDataSet, pointerItem5 = _c.pointerItem5, setPointerItem5 = _c.setPointerItem5, secondaryPointerY = _c.secondaryPointerY, setSecondaryPointerY = _c.setSecondaryPointerY, secondaryPointerItem = _c.secondaryPointerItem, setSecondaryPointerItem = _c.setSecondaryPointerItem, responderStartTime = _c.responderStartTime, setResponderStartTime = _c.setResponderStartTime, setResponderActive = _c.setResponderActive, points = _c.points, points2 = _c.points2, points3 = _c.points3, points4 = _c.points4, points5 = _c.points5, secondaryPoints = _c.secondaryPoints, fillPoints = _c.fillPoints, fillPoints2 = _c.fillPoints2, fillPoints3 = _c.fillPoints3, fillPoints4 = _c.fillPoints4, fillPoints5 = _c.fillPoints5, secondaryFillPoints = _c.secondaryFillPoints, pointsFromSet = _c.pointsFromSet, fillPointsFromSet = _c.fillPointsFromSet, arrowPointsFromSet = _c.arrowPointsFromSet, selectedIndex = _c.selectedIndex, setSelectedIndex = _c.setSelectedIndex, containerHeight = _c.containerHeight, data = _c.data, data2 = _c.data2, data3 = _c.data3, data4 = _c.data4, data5 = _c.data5, secondaryData = _c.secondaryData, dataSet = _c.dataSet, data0 = _c.data0, labelsExtraHeight = _c.labelsExtraHeight, animationDuration = _c.animationDuration, onDataChangeAnimationDuration = _c.onDataChangeAnimationDuration, animateTogether = _c.animateTogether, animateOnDataChange = _c.animateOnDataChange, startIndex1 = _c.startIndex1, startIndex2 = _c.startIndex2, endIndex1 = _c.endIndex1, endIndex2 = _c.endIndex2, startIndex3 = _c.startIndex3, endIndex3 = _c.endIndex3, startIndex4 = _c.startIndex4, endIndex4 = _c.endIndex4, startIndex5 = _c.startIndex5, endIndex5 = _c.endIndex5, initialSpacing = _c.initialSpacing, thickness = _c.thickness, yAxisLabelWidth = _c.yAxisLabelWidth, spacing = _c.spacing, xAxisThickness = _c.xAxisThickness, dataPointsHeight1 = _c.dataPointsHeight1, dataPointsWidth1 = _c.dataPointsWidth1, dataPointsRadius1 = _c.dataPointsRadius1, dataPointsColor1 = _c.dataPointsColor1, dataPointsShape1 = _c.dataPointsShape1, dataPointsHeight2 = _c.dataPointsHeight2, dataPointsWidth2 = _c.dataPointsWidth2, dataPointsRadius2 = _c.dataPointsRadius2, dataPointsColor2 = _c.dataPointsColor2, dataPointsShape2 = _c.dataPointsShape2, dataPointsHeight3 = _c.dataPointsHeight3, dataPointsWidth3 = _c.dataPointsWidth3, dataPointsRadius3 = _c.dataPointsRadius3, dataPointsColor3 = _c.dataPointsColor3, dataPointsShape3 = _c.dataPointsShape3, dataPointsHeight4 = _c.dataPointsHeight4, dataPointsWidth4 = _c.dataPointsWidth4, dataPointsRadius4 = _c.dataPointsRadius4, dataPointsColor4 = _c.dataPointsColor4, dataPointsShape4 = _c.dataPointsShape4, dataPointsHeight5 = _c.dataPointsHeight5, dataPointsWidth5 = _c.dataPointsWidth5, dataPointsRadius5 = _c.dataPointsRadius5, dataPointsColor5 = _c.dataPointsColor5, dataPointsShape5 = _c.dataPointsShape5, getIsNthAreaChart = _c.getIsNthAreaChart, textFontSize1 = _c.textFontSize1, textFontSize2 = _c.textFontSize2, textFontSize3 = _c.textFontSize3, textFontSize4 = _c.textFontSize4, textFontSize5 = _c.textFontSize5, textColor1 = _c.textColor1, textColor2 = _c.textColor2, textColor3 = _c.textColor3, textColor4 = _c.textColor4, textColor5 = _c.textColor5, totalWidth = _c.totalWidth, maxValue = _c.maxValue, overflowTop = _c.overflowTop, extendedContainerHeight = _c.extendedContainerHeight, getX = _c.getX, getY = _c.getY, getSecondaryY = _c.getSecondaryY, secondaryMaxValue = _c.secondaryMaxValue, showValuesAsDataPointsText = _c.showValuesAsDataPointsText, thickness1 = _c.thickness1, thickness2 = _c.thickness2, thickness3 = _c.thickness3, thickness4 = _c.thickness4, thickness5 = _c.thickness5, zIndex1 = _c.zIndex1, zIndex2 = _c.zIndex2, zIndex3 = _c.zIndex3, zIndex4 = _c.zIndex4, zIndex5 = _c.zIndex5, strokeDashArray1 = _c.strokeDashArray1, strokeDashArray2 = _c.strokeDashArray2, strokeDashArray3 = _c.strokeDashArray3, strokeDashArray4 = _c.strokeDashArray4, strokeDashArray5 = _c.strokeDashArray5, rotateLabel = _c.rotateLabel, isAnimated = _c.isAnimated, hideDataPoints1 = _c.hideDataPoints1, hideDataPoints2 = _c.hideDataPoints2, hideDataPoints3 = _c.hideDataPoints3, hideDataPoints4 = _c.hideDataPoints4, hideDataPoints5 = _c.hideDataPoints5, color1 = _c.color1, color2 = _c.color2, color3 = _c.color3, color4 = _c.color4, color5 = _c.color5, startFillColor1 = _c.startFillColor1, endFillColor1 = _c.endFillColor1, startOpacity1 = _c.startOpacity1, endOpacity1 = _c.endOpacity1, startFillColor2 = _c.startFillColor2, endFillColor2 = _c.endFillColor2, startOpacity2 = _c.startOpacity2, endOpacity2 = _c.endOpacity2, startFillColor3 = _c.startFillColor3, endFillColor3 = _c.endFillColor3, startOpacity3 = _c.startOpacity3, endOpacity3 = _c.endOpacity3, startFillColor4 = _c.startFillColor4, endFillColor4 = _c.endFillColor4, startOpacity4 = _c.startOpacity4, endOpacity4 = _c.endOpacity4, startFillColor5 = _c.startFillColor5, endFillColor5 = _c.endFillColor5, startOpacity5 = _c.startOpacity5, endOpacity5 = _c.endOpacity5, arrowStrokeWidth1 = _c.arrowStrokeWidth1, arrowStrokeColor1 = _c.arrowStrokeColor1, arrowFillColor1 = _c.arrowFillColor1, arrowStrokeWidth2 = _c.arrowStrokeWidth2, arrowStrokeColor2 = _c.arrowStrokeColor2, arrowFillColor2 = _c.arrowFillColor2, arrowStrokeWidth3 = _c.arrowStrokeWidth3, arrowStrokeColor3 = _c.arrowStrokeColor3, arrowFillColor3 = _c.arrowFillColor3, arrowStrokeWidth4 = _c.arrowStrokeWidth4, arrowStrokeColor4 = _c.arrowStrokeColor4, arrowFillColor4 = _c.arrowFillColor4, arrowStrokeWidth5 = _c.arrowStrokeWidth5, arrowStrokeColor5 = _c.arrowStrokeColor5, arrowFillColor5 = _c.arrowFillColor5, arrowStrokeWidthsFromSet = _c.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _c.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _c.arrowFillColorsFromSet, secondaryLineConfig = _c.secondaryLineConfig, gradientDirection = _c.gradientDirection, stepHeight = _c.stepHeight, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _c.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, pointerConfig = _c.pointerConfig, pointerHeight = _c.pointerHeight, pointerWidth = _c.pointerWidth, pointerRadius = _c.pointerRadius, pointerColor = _c.pointerColor, pointerComponent = _c.pointerComponent, showPointerStrip = _c.showPointerStrip, pointerStripHeight = _c.pointerStripHeight, pointerStripWidth = _c.pointerStripWidth, pointerStripColor = _c.pointerStripColor, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerLabelComponent = _c.pointerLabelComponent, stripOverPointer = _c.stripOverPointer, shiftPointerLabelX = _c.shiftPointerLabelX, shiftPointerLabelY = _c.shiftPointerLabelY, pointerLabelWidth = _c.pointerLabelWidth, pointerLabelHeight = _c.pointerLabelHeight, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerVanishDelay = _c.pointerVanishDelay, activatePointersOnLongPress = _c.activatePointersOnLongPress, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, hidePointer1 = _c.hidePointer1, hidePointer2 = _c.hidePointer2, hidePointer3 = _c.hidePointer3, hidePointer4 = _c.hidePointer4, hidePointer5 = _c.hidePointer5, hideSecondaryPointer = _c.hideSecondaryPointer, pointerEvents = _c.pointerEvents, focusEnabled = _c.focusEnabled, showDataPointOnFocus = _c.showDataPointOnFocus, showStripOnFocus = _c.showStripOnFocus, showTextOnFocus = _c.showTextOnFocus, showDataPointLabelOnFocus = _c.showDataPointLabelOnFocus, stripHeight = _c.stripHeight, stripWidth = _c.stripWidth, stripColor = _c.stripColor, stripOpacity = _c.stripOpacity, stripStrokeDashArray = _c.stripStrokeDashArray, unFocusOnPressOut = _c.unFocusOnPressOut, delayBeforeUnFocus = _c.delayBeforeUnFocus, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, lineGradient = _c.lineGradient, lineGradientDirection = _c.lineGradientDirection, lineGradientStartColor = _c.lineGradientStartColor, lineGradientEndColor = _c.lineGradientEndColor, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps;
66
59
  var secondaryXAxis = props.secondaryXAxis;
67
60
  var widthValuesFromSet = useMemo(function () { return dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return new Animated.Value(0); }); }, []);
61
+ var animatedPoints = new Animated.Value(0);
62
+ var animatedFillPoints = new Animated.Value(0);
63
+ var oldPoints = usePrevious(points);
64
+ var oldFillPoints = usePrevious(fillPoints);
65
+ var animatedPath = animateOnDataChange && points && oldPoints
66
+ ? animatedPoints.interpolate({
67
+ inputRange: [0, 1],
68
+ outputRange: [oldPoints, points],
69
+ })
70
+ : '';
71
+ var animatedFillPath = animateOnDataChange && fillPoints && oldFillPoints
72
+ ? animatedFillPoints.interpolate({
73
+ inputRange: [0, 1],
74
+ outputRange: [oldFillPoints, fillPoints],
75
+ })
76
+ : '';
68
77
  useEffect(function () {
69
78
  if (animateOnDataChange) {
70
- Animated.parallel(animations.map(function (anItem, index) {
71
- var _a, _b;
72
- return Animated.timing(anItem, {
73
- toValue: (_b = (_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0,
74
- useNativeDriver: Platform.OS === 'ios', // if useNativeDriver is set to true, animateOnDataChange feature fails for Android, so setting it true only for iOS
79
+ Animated.timing(animatedPoints, {
80
+ toValue: 1,
81
+ duration: onDataChangeAnimationDuration,
82
+ useNativeDriver: true,
83
+ easing: Easing.ease,
84
+ }).start();
85
+ if (props.areaChart || props.areaChart1) {
86
+ Animated.timing(animatedFillPoints, {
87
+ toValue: 1,
75
88
  duration: onDataChangeAnimationDuration,
76
- });
77
- })).start();
89
+ useNativeDriver: true,
90
+ easing: Easing.ease,
91
+ }).start();
92
+ }
78
93
  }
79
- }, [animateOnDataChange, data, onDataChangeAnimationDuration]);
94
+ }, [animatedPoints]);
80
95
  var labelsAppear = useCallback(function () {
81
- opacValue.setValue(0);
82
- Animated.timing(opacValue, {
96
+ opacityValue.setValue(0);
97
+ Animated.timing(opacityValue, {
83
98
  toValue: 1,
84
99
  duration: 500,
85
100
  easing: Easing.ease,
86
101
  useNativeDriver: false,
87
102
  }).start();
88
- }, [opacValue]);
89
- var appearingOpacity = opacValue.interpolate({
103
+ }, [opacityValue]);
104
+ var appearingOpacity = opacityValue.interpolate({
90
105
  inputRange: [0, 1],
91
106
  outputRange: [0, 1],
92
107
  });
@@ -205,7 +220,7 @@ export var LineChart = function (props) {
205
220
  {
206
221
  height: rotateLabel
207
222
  ? 40
208
- : (_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18,
223
+ : ((_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18),
209
224
  position: 'absolute',
210
225
  bottom: top
211
226
  ? containerHeight +
@@ -542,6 +557,10 @@ export var LineChart = function (props) {
542
557
  secondaryPointerItem: secondaryPointerItem,
543
558
  scrollX: scrollX,
544
559
  pointerEvents: pointerEvents,
560
+ isBarChart: false,
561
+ pointerIndex: pointerIndex,
562
+ width: totalWidth,
563
+ screenWidth: screenWidth,
545
564
  });
546
565
  };
547
566
  var getLineGradientComponent = function () {
@@ -564,7 +583,7 @@ export var LineChart = function (props) {
564
583
  ar = getSegmentedPathObjects(points, color, currentLineThickness !== null && currentLineThickness !== void 0 ? currentLineThickness : 0, thickness, strokeDashArray !== null && strokeDashArray !== void 0 ? strokeDashArray : [], isCurved, SEGMENT_START, SEGMENT_END);
565
584
  }
566
585
  var lineSvgPropsOuter = {
567
- d: points,
586
+ d: animateOnDataChange && animatedPath ? animatedPath : points,
568
587
  fill: 'none',
569
588
  stroke: lineGradient
570
589
  ? props.lineGradientId
@@ -597,10 +616,12 @@ export var LineChart = function (props) {
597
616
  lineSvgProps.strokeDasharray = item.strokeDashArray;
598
617
  }
599
618
  return _jsx(Path, __assign({}, lineSvgProps), index);
600
- })) : (_jsx(Path, __assign({}, lineSvgPropsOuter))), isNthAreaChart &&
601
- getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart && (_jsx(Path, { onPress: props.onChartAreaPress, d: fillPoints, fill: props.areaGradientId
619
+ })) : animateOnDataChange && animatedPath ? (_jsx(AnimatedPath, __assign({}, lineSvgPropsOuter))) : (_jsx(Path, __assign({}, lineSvgPropsOuter))), isNthAreaChart &&
620
+ getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart ? (animateOnDataChange && animatedFillPath ? (_jsx(AnimatedPath, { onPress: props.onChartAreaPress, d: animatedFillPath, fill: props.areaGradientId
621
+ ? "url(#".concat(props.areaGradientId, ")")
622
+ : "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness })) : (_jsx(Path, { onPress: props.onChartAreaPress, d: fillPoints, fill: props.areaGradientId
602
623
  ? "url(#".concat(props.areaGradientId, ")")
603
- : "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness })), renderSpecificVerticalLines(data), renderSpecificVerticalLines(data2), renderSpecificVerticalLines(data3), renderSpecificVerticalLines(data4), renderSpecificVerticalLines(data5), (_a = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return renderSpecificVerticalLines(set === null || set === void 0 ? void 0 : set.data); })) !== null && _a !== void 0 ? _a : null, (_b = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
624
+ : "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness }))) : null, renderSpecificVerticalLines(data), renderSpecificVerticalLines(data2), renderSpecificVerticalLines(data3), renderSpecificVerticalLines(data4), renderSpecificVerticalLines(data5), (_a = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return renderSpecificVerticalLines(set === null || set === void 0 ? void 0 : set.data); })) !== null && _a !== void 0 ? _a : null, (_b = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
604
625
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
605
626
  return renderDataPoints((_a = set.hideDataPoints) !== null && _a !== void 0 ? _a : hideDataPoints1, set.data, adjustToOffset(set.data, -((_b = props.yAxisOffset) !== null && _b !== void 0 ? _b : 0)), // need the actual values passed by user
606
627
  (_c = set.dataPointsShape) !== null && _c !== void 0 ? _c : dataPointsShape1, (_d = set.dataPointsWidth) !== null && _d !== void 0 ? _d : dataPointsWidth1, (_e = set.dataPointsHeight) !== null && _e !== void 0 ? _e : dataPointsHeight1, (_f = set.dataPointsColor) !== null && _f !== void 0 ? _f : dataPointsColor1, (_g = set.dataPointsRadius) !== null && _g !== void 0 ? _g : dataPointsRadius1, (_h = set.textColor) !== null && _h !== void 0 ? _h : textColor1, (_j = set.textFontSize) !== null && _j !== void 0 ? _j : textFontSize1, (_k = set.startIndex) !== null && _k !== void 0 ? _k : 0, (_l = set.endIndex) !== null && _l !== void 0 ? _l : set.data.length - 1, set.isSecondary, showValuesAsDataPointsText);
@@ -0,0 +1,2 @@
1
+ declare function usePrevious(value: string): string;
2
+ export default usePrevious;
@@ -0,0 +1,9 @@
1
+ import { useEffect, useRef } from "react";
2
+ function usePrevious(value) {
3
+ var ref = useRef('');
4
+ useEffect(function () {
5
+ ref.current = value; //assign the value of ref to the argument
6
+ }, [value]); //this code will run when the value of 'value' changes
7
+ return ref.current; //in the end, return the current ref value.
8
+ }
9
+ export default usePrevious;
@@ -1,2 +1,3 @@
1
1
  export declare const rnVersion: number;
2
2
  export declare const screenWidth: number;
3
+ export declare function usePrevious(value: string): string;
@@ -1,4 +1,5 @@
1
1
  var _a, _b;
2
+ import { useEffect, useRef } from 'react';
2
3
  import { Dimensions } from 'react-native';
3
4
  // eslint-disable-next-line @typescript-eslint/no-var-requires
4
5
  var versionString = require('react-native/package.json').version;
@@ -10,3 +11,10 @@ export var rnVersion = (!isNaN(msb) ? msb : 0) * 1000000 +
10
11
  (!isNaN(mid) ? mid : 0) * 10000 +
11
12
  (!isNaN(lsb) ? lsb : 0);
12
13
  export var screenWidth = Dimensions.get('window').width;
14
+ export function usePrevious(value) {
15
+ var ref = useRef('');
16
+ useEffect(function () {
17
+ ref.current = value; //assign the value of ref to the argument
18
+ }, [value]); //this code will run when the value of 'value' changes
19
+ return ref.current; //in the end, return the current ref value.
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.22",
3
+ "version": "1.4.23",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "dependencies": {
28
- "gifted-charts-core": "^0.1.21"
28
+ "gifted-charts-core": "^0.1.25"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/cli": "^7.24.8",