react-native-gifted-charts 0.2.4 → 0.2.8

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": "0.2.4",
3
+ "version": "0.2.8",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "src/index.tsx",
6
6
  "files": [
@@ -1,7 +1,18 @@
1
1
  import React, {useEffect, useState} from 'react';
2
- import {View, ColorValue, LayoutAnimation, Platform} from 'react-native';
2
+ import {
3
+ View,
4
+ ColorValue,
5
+ LayoutAnimation,
6
+ Platform,
7
+ UIManager,
8
+ } from 'react-native';
3
9
  import LinearGradient from 'react-native-linear-gradient';
4
10
 
11
+ if (Platform.OS === 'android') {
12
+ UIManager.setLayoutAnimationEnabledExperimental &&
13
+ UIManager.setLayoutAnimationEnabledExperimental(true);
14
+ }
15
+
5
16
  type propTypes = {
6
17
  item: itemType;
7
18
  height: number;
@@ -44,7 +55,7 @@ type itemType = {
44
55
 
45
56
  const Animated2DWithGradient = (props: propTypes) => {
46
57
  const {item, opacity, animationDuration, noGradient, noAnimation} = props;
47
- const [height, setHeight] = useState(noAnimation ? props.height : 0);
58
+ const [height, setHeight] = useState(noAnimation ? props.height : 2);
48
59
  const [initialRender, setInitialRender] = useState(
49
60
  noAnimation ? false : true,
50
61
  );
@@ -561,16 +561,22 @@ export const BarChart = (props: PropTypes) => {
561
561
  ],
562
562
  },
563
563
  ]}>
564
- {showFractionalValues
564
+ {hideOrigin
565
+ ? index === horizSections.length - 1
566
+ ? ''
567
+ : showFractionalValues
568
+ ? sectionItems.value
569
+ ? sectionItems.value
570
+ : '0'
571
+ : sectionItems.value
572
+ ? sectionItems.value.toString().split('.')[0]
573
+ : '0'
574
+ : showFractionalValues
565
575
  ? sectionItems.value
566
576
  ? sectionItems.value
567
- : hideOrigin
568
- ? ''
569
577
  : '0'
570
578
  : sectionItems.value
571
579
  ? sectionItems.value.toString().split('.')[0]
572
- : hideOrigin
573
- ? ''
574
580
  : '0'}
575
581
  </Text>
576
582
  ) : null}
@@ -5,10 +5,16 @@ import {
5
5
  ColorValue,
6
6
  LayoutAnimation,
7
7
  Platform,
8
+ UIManager,
8
9
  } from 'react-native';
9
10
  import LinearGradient from 'react-native-linear-gradient';
10
11
  import {styles} from './styles';
11
12
 
13
+ if (Platform.OS === 'android') {
14
+ UIManager.setLayoutAnimationEnabledExperimental &&
15
+ UIManager.setLayoutAnimationEnabledExperimental(true);
16
+ }
17
+
12
18
  type trianglePropTypes = {
13
19
  style: any;
14
20
  width: number;
@@ -89,7 +95,7 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
89
95
  const layoutAppear = () => {
90
96
  LayoutAnimation.configureNext({
91
97
  duration: Platform.OS == 'ios' ? animationDuration : 20,
92
- create: {type: 'linear', property: 'opacity'},
98
+ create: {type: 'linear', property: 'scaleXY'},
93
99
  // update: { type: 'linear' }
94
100
  });
95
101
  setInitialRender(false);
@@ -450,7 +450,7 @@ export const LineChart = (props: propTypes) => {
450
450
  totalWidth += spacing;
451
451
  });
452
452
 
453
- const maxValue = props.maxValue || maxItem;
453
+ const maxValue = props.maxValue || maxItem || 10;
454
454
 
455
455
  useEffect(() => {
456
456
  // console.log('comes here............')
@@ -1061,16 +1061,22 @@ export const LineChart = (props: propTypes) => {
1061
1061
  marginBottom: stepHeight / -2,
1062
1062
  },
1063
1063
  ]}>
1064
- {showFractionalValues
1064
+ {hideOrigin
1065
+ ? index === horizSections.length - 1
1066
+ ? ''
1067
+ : showFractionalValues
1068
+ ? sectionItems.value
1069
+ ? sectionItems.value
1070
+ : '0'
1071
+ : sectionItems.value
1072
+ ? sectionItems.value.toString().split('.')[0]
1073
+ : '0'
1074
+ : showFractionalValues
1065
1075
  ? sectionItems.value
1066
1076
  ? sectionItems.value
1067
- : hideOrigin
1068
- ? ''
1069
1077
  : '0'
1070
1078
  : sectionItems.value
1071
1079
  ? sectionItems.value.toString().split('.')[0]
1072
- : hideOrigin
1073
- ? ''
1074
1080
  : '0'}
1075
1081
  </Text>
1076
1082
  ) : null}