react-native-gifted-charts 1.4.3 → 1.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
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": "src/index.tsx",
6
6
  "files": [
@@ -24,7 +24,7 @@
24
24
  "registry": "https://registry.npmjs.org/"
25
25
  },
26
26
  "dependencies": {
27
- "gifted-charts-core": "^0.0.13"
27
+ "gifted-charts-core": "^0.0.14"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.22.5",
@@ -48,6 +48,7 @@ const RenderBars = (props: RenderBarsPropsType) => {
48
48
  topLabelContainerStyle,
49
49
  topLabelTextStyle,
50
50
  pointerConfig,
51
+ noOfSectionsBelowXAxis,
51
52
  } = props;
52
53
 
53
54
  const barHeight = Math.max(
@@ -112,7 +113,11 @@ const RenderBars = (props: RenderBarsPropsType) => {
112
113
  ? {
113
114
  transform: [
114
115
  {rotate: '180deg'},
115
- {translateY: autoShiftLabels ? 0 : 32},
116
+ {
117
+ translateY: autoShiftLabels
118
+ ? 0
119
+ : 16.5 * xAxisTextNumberOfLines + 14,
120
+ },
116
121
  ],
117
122
  }
118
123
  : {},
@@ -166,7 +171,18 @@ const RenderBars = (props: RenderBarsPropsType) => {
166
171
  : {transform: [{rotate: '60deg'}]}
167
172
  : horizontal
168
173
  ? {transform: [{rotate: '-90deg'}]}
169
- : {},
174
+ : value < 0
175
+ ? {
176
+ transform: [
177
+ {rotate: '180deg'},
178
+ {
179
+ translateY: autoShiftLabels
180
+ ? 0
181
+ : 16.5 * xAxisTextNumberOfLines + 14,
182
+ },
183
+ ],
184
+ }
185
+ : {},
170
186
  ]}>
171
187
  {item.labelComponent ? (
172
188
  item.labelComponent()
@@ -300,6 +316,8 @@ const RenderBars = (props: RenderBarsPropsType) => {
300
316
  (pointerConfig && pointerConfig.barTouchable !== true);
301
317
 
302
318
  const barContent = () => {
319
+ const isBarBelowXaxisAndInvisible =
320
+ item.value < 0 && !noOfSectionsBelowXAxis;
303
321
  const animated2DWithGradient = (noGradient, noAnimation) => (
304
322
  <Animated2DWithGradient
305
323
  {...commonPropsFor2Dand3Dbars}
@@ -341,7 +359,7 @@ const RenderBars = (props: RenderBarsPropsType) => {
341
359
  }}
342
360
  />
343
361
  )}
344
- {isThreeD ? (
362
+ {isBarBelowXaxisAndInvisible ? null : isThreeD ? (
345
363
  <AnimatedThreeDBar
346
364
  {...commonPropsFor2Dand3Dbars}
347
365
  sideWidth={
@@ -401,6 +419,13 @@ const RenderBars = (props: RenderBarsPropsType) => {
401
419
  ? props.onLongPress(item, index)
402
420
  : null;
403
421
  }}
422
+ onPressOut={() => {
423
+ item.onPressOut
424
+ ? item.onPressOut()
425
+ : props.onPressOut
426
+ ? props.onPressOut(item, index)
427
+ : null;
428
+ }}
404
429
  style={barWrapperStyle}>
405
430
  {barContent()}
406
431
  </TouchableOpacity>
@@ -9,7 +9,11 @@ import {
9
9
  } from 'react-native';
10
10
  import LinearGradient from 'react-native-linear-gradient';
11
11
  import Svg, {Defs, Rect} from 'react-native-svg';
12
- import { useRenderStackBars, BarDefaults, StackedBarChartPropsType } from 'gifted-charts-core';
12
+ import {
13
+ useRenderStackBars,
14
+ BarDefaults,
15
+ StackedBarChartPropsType,
16
+ } from 'gifted-charts-core';
13
17
 
14
18
  if (Platform.OS === 'android') {
15
19
  UIManager.setLayoutAnimationEnabledExperimental &&
@@ -121,7 +125,6 @@ const RenderStackBars = (props: StackedBarChartPropsType) => {
121
125
  };
122
126
 
123
127
  const static2DSimple = () => {
124
-
125
128
  return (
126
129
  <>
127
130
  <TouchableOpacity
@@ -135,13 +138,20 @@ const RenderStackBars = (props: StackedBarChartPropsType) => {
135
138
  props.onPress(item, index);
136
139
  }
137
140
  }}
138
- onLongPress={()=>{
141
+ onLongPress={() => {
139
142
  if (item.onLongPress) {
140
143
  item.onLongPress();
141
144
  } else if (props.onLongPress) {
142
145
  props.onLongPress(item, index);
143
146
  }
144
147
  }}
148
+ onPressOut={() => {
149
+ if (item.onPressOut) {
150
+ item.onPressOut();
151
+ } else if (props.onPressOut) {
152
+ props.onPressOut(item, index);
153
+ }
154
+ }}
145
155
  style={[
146
156
  {
147
157
  position: 'absolute',