react-native-gifted-charts 1.4.2 → 1.4.3

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.2",
3
+ "version": "1.4.3",
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.10"
27
+ "gifted-charts-core": "^0.0.13"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.22.5",
@@ -173,35 +173,35 @@ const Animated2DWithGradient = (props: Animated2DWithGradientPropsType) => {
173
173
  </View>
174
174
  ) : null}
175
175
  </View>
176
- {(item.topLabelComponent || showValuesAsTopLabel) && (
177
- <View
178
- style={[
179
- {
180
- position: 'absolute',
181
- top: (item.barWidth || barWidth || 30) * -1,
182
- height: item.barWidth || barWidth || 30,
183
- width: item.barWidth || barWidth || 30,
184
- justifyContent:
185
- (props.horizontal && !intactTopLabel) || item.value < 0
186
- ? 'center'
187
- : 'flex-end',
188
- alignItems: 'center',
189
- opacity: opacity,
190
- },
191
- item.value < 0 && {transform: [{rotate: '180deg'}]},
192
- props.horizontal &&
193
- !intactTopLabel && {transform: [{rotate: '270deg'}]},
194
- topLabelContainerStyle ?? item.topLabelContainerStyle,
195
- ]}>
196
- {showValuesAsTopLabel ? (
197
- <Text style={topLabelTextStyle}>{item.value}</Text>
198
- ) : (
199
- item.topLabelComponent?.()
200
- )}
201
- </View>
202
- )}
203
176
  </View>
204
177
  )}
178
+ {item.topLabelComponent || showValuesAsTopLabel ? (
179
+ <View
180
+ style={[
181
+ {
182
+ position: 'absolute',
183
+ top: (item.barWidth || barWidth || 30) * -1,
184
+ height: item.barWidth || barWidth || 30,
185
+ width: item.barWidth || barWidth || 30,
186
+ justifyContent:
187
+ (props.horizontal && !intactTopLabel) || item.value < 0
188
+ ? 'center'
189
+ : 'flex-end',
190
+ alignItems: 'center',
191
+ opacity: opacity,
192
+ },
193
+ item.value < 0 && {transform: [{rotate: '180deg'}]},
194
+ props.horizontal &&
195
+ !intactTopLabel && {transform: [{rotate: '270deg'}]},
196
+ topLabelContainerStyle ?? item.topLabelContainerStyle,
197
+ ]}>
198
+ {showValuesAsTopLabel ? (
199
+ <Text style={topLabelTextStyle}>{item.value}</Text>
200
+ ) : (
201
+ item.topLabelComponent?.()
202
+ )}
203
+ </View>
204
+ ) : null}
205
205
  </>
206
206
  );
207
207
  };
@@ -3,11 +3,7 @@ import {Animated, Easing, View} from 'react-native';
3
3
  import RenderBars from './RenderBars';
4
4
  import RenderStackBars from './RenderStackBars';
5
5
  import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
6
- import {
7
- BarChartPropsType,
8
- useBarChart,
9
- screenWidth,
10
- } from 'gifted-charts-core';
6
+ import {BarChartPropsType, useBarChart, screenWidth} from 'gifted-charts-core';
11
7
  import {StripAndLabel} from '../Components/common/StripAndLabel';
12
8
  import {Pointer} from '../Components/common/Pointer';
13
9
 
@@ -338,7 +334,7 @@ export const BarChart = (props: BarChartPropsType) => {
338
334
  <RenderBars
339
335
  data={data}
340
336
  side={side}
341
- minHeight={props.minHeight || 0}
337
+ minHeight={props.minHeight ?? (isAnimated && !isThreeD ? 0.1 : 0)}
342
338
  sideWidth={props.sideWidth}
343
339
  labelWidth={labelWidth}
344
340
  isThreeD={isThreeD}
@@ -10,7 +10,11 @@ import {
10
10
  import LinearGradient from 'react-native-linear-gradient';
11
11
  import Svg, {Defs, Rect} from 'react-native-svg';
12
12
  import {styles} from './styles';
13
- import { useAnimatedThreeDBar, animatedBarPropTypes, trianglePropTypes } from 'gifted-charts-core';
13
+ import {
14
+ useAnimatedThreeDBar,
15
+ animatedBarPropTypes,
16
+ trianglePropTypes,
17
+ } from 'gifted-charts-core';
14
18
 
15
19
  if (Platform.OS === 'android') {
16
20
  UIManager.setLayoutAnimationEnabledExperimental &&
@@ -154,28 +158,26 @@ const AnimatedThreeDBar = (props: animatedBarPropTypes) => {
154
158
 
155
159
  {/*******************************************************************/}
156
160
 
157
- {props.height ? (
158
- <View style={{marginTop: sideWidth / -2}}>
159
- <TriangleCorner
160
- color={sideColor}
161
- width={sideWidth}
162
- style={{transform: [{rotate: '-90deg'}], opacity: opacity}}
163
- />
164
- <View
165
- style={{
166
- width: sideWidth / 2,
167
- height: height - sideWidth / 2, //animatedSideHeight
168
- backgroundColor: sideColor,
169
- opacity: opacity,
170
- }}
171
- />
172
- <TriangleCorner
173
- color={sideColor}
174
- width={sideWidth}
175
- style={{transform: [{rotate: '90deg'}], opacity: opacity}}
176
- />
177
- </View>
178
- ) : null}
161
+ <View style={{marginTop: sideWidth / -2}}>
162
+ <TriangleCorner
163
+ color={height ? sideColor : 'transparent'}
164
+ width={sideWidth}
165
+ style={{transform: [{rotate: '-90deg'}], opacity: opacity}}
166
+ />
167
+ <View
168
+ style={{
169
+ width: sideWidth / 2,
170
+ height: height - sideWidth / 2, //animatedSideHeight
171
+ backgroundColor: sideColor,
172
+ opacity: opacity,
173
+ }}
174
+ />
175
+ <TriangleCorner
176
+ color={height ? sideColor : 'transparent'}
177
+ width={sideWidth}
178
+ style={{transform: [{rotate: '90deg'}], opacity: opacity}}
179
+ />
180
+ </View>
179
181
 
180
182
  <View
181
183
  style={[
@@ -104,7 +104,6 @@ export const LineChart = (props: LineChartPropsType) => {
104
104
  arrowPointsFromSet,
105
105
  selectedIndex,
106
106
  setSelectedIndex,
107
- noOfSections,
108
107
  containerHeight,
109
108
  data,
110
109
  data2,
@@ -298,7 +297,7 @@ export const LineChart = (props: LineChartPropsType) => {
298
297
 
299
298
  if (!initialData) {
300
299
  initialData = data0 ?? [...data];
301
- animations = initialData.map(item => new Animated.Value(item.value));
300
+ animations = initialData?.map(item => new Animated.Value(item.value));
302
301
  }
303
302
 
304
303
  const widthValuesFromSet = useMemo(