react-native-gifted-charts 1.4.11 → 1.4.12
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/README.md +1 -1
- package/dist/BarChart/Animated2DWithGradient.js +1 -0
- package/dist/BarChart/RenderBars.js +1 -0
- package/dist/BarChart/RenderStackBars.js +1 -0
- package/dist/BarChart/index.js +1 -0
- package/dist/BarChart/styles.js +1 -0
- package/dist/Components/AnimatedThreeDBar/index.js +1 -0
- package/dist/Components/AnimatedThreeDBar/styles.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/index.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +1 -0
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +1 -0
- package/dist/Components/BarSpecificComponents/cap.js +1 -0
- package/dist/Components/common/LinearGradient.js +1 -0
- package/dist/Components/common/Pointer.js +1 -0
- package/dist/Components/common/StripAndLabel.js +1 -0
- package/dist/Components/lineSvg.js +1 -0
- package/dist/LineChart/LineChartBicolor.js +1 -0
- package/dist/LineChart/index.js +1 -0
- package/dist/LineChart/styles.js +1 -0
- package/dist/PieChart/index.js +1 -0
- package/dist/PieChart/main.js +1 -0
- package/dist/PieChartPro/index.js +1 -0
- package/dist/PopulationPyramid/index.js +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +10 -5
- package/src/BarChart/Animated2DWithGradient.tsx +0 -197
- package/src/BarChart/RenderBars.tsx +0 -454
- package/src/BarChart/RenderStackBars.tsx +0 -383
- package/src/BarChart/index.tsx +0 -373
- package/src/BarChart/styles.tsx +0 -47
- package/src/Components/AnimatedThreeDBar/index.tsx +0 -258
- package/src/Components/AnimatedThreeDBar/styles.tsx +0 -14
- package/src/Components/BarAndLineChartsWrapper/index.tsx +0 -244
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +0 -590
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +0 -147
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +0 -157
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +0 -86
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +0 -42
- package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +0 -131
- package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +0 -30
- package/src/Components/BarSpecificComponents/cap.tsx +0 -34
- package/src/Components/common/LinearGradient.tsx +0 -27
- package/src/Components/common/Pointer.tsx +0 -37
- package/src/Components/common/StripAndLabel.tsx +0 -98
- package/src/Components/lineSvg.tsx +0 -42
- package/src/LineChart/LineChartBicolor.tsx +0 -740
- package/src/LineChart/index.tsx +0 -2156
- package/src/LineChart/styles.tsx +0 -47
- package/src/PieChart/index.tsx +0 -165
- package/src/PieChart/main.tsx +0 -363
- package/src/PieChartPro/index.tsx +0 -267
- package/src/PopulationPyramid/index.tsx +0 -603
- package/src/index.tsx +0 -25
- package/src/todos.md +0 -23
- package/src/utils/index.ts +0 -16
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {View, TouchableOpacity, Animated, Text} from 'react-native';
|
|
3
|
-
import AnimatedThreeDBar from '../Components/AnimatedThreeDBar';
|
|
4
|
-
import Animated2DWithGradient from './Animated2DWithGradient';
|
|
5
|
-
import Cap from '../Components/BarSpecificComponents/cap';
|
|
6
|
-
import BarBackgroundPattern from '../Components/BarSpecificComponents/barBackgroundPattern';
|
|
7
|
-
import LinearGradient from '../Components/common/LinearGradient';
|
|
8
|
-
import {
|
|
9
|
-
getPropsForAnimated2DWithGradient,
|
|
10
|
-
RenderBarsPropsType,
|
|
11
|
-
barDataItem,
|
|
12
|
-
AxesAndRulesDefaults,
|
|
13
|
-
} from 'gifted-charts-core';
|
|
14
|
-
|
|
15
|
-
const RenderBars = (props: RenderBarsPropsType) => {
|
|
16
|
-
const {
|
|
17
|
-
item,
|
|
18
|
-
index,
|
|
19
|
-
containerHeight,
|
|
20
|
-
maxValue,
|
|
21
|
-
minHeight,
|
|
22
|
-
spacing,
|
|
23
|
-
propSpacing,
|
|
24
|
-
side,
|
|
25
|
-
data,
|
|
26
|
-
barBorderWidth,
|
|
27
|
-
barBorderColor,
|
|
28
|
-
isThreeD,
|
|
29
|
-
isAnimated,
|
|
30
|
-
rotateLabel,
|
|
31
|
-
appearingOpacity,
|
|
32
|
-
animationDuration,
|
|
33
|
-
autoShiftLabels,
|
|
34
|
-
label,
|
|
35
|
-
labelTextStyle,
|
|
36
|
-
xAxisTextNumberOfLines,
|
|
37
|
-
xAxisLabelsVerticalShift,
|
|
38
|
-
renderTooltip,
|
|
39
|
-
leftShiftForTooltip,
|
|
40
|
-
leftShiftForLastIndexTooltip,
|
|
41
|
-
initialSpacing,
|
|
42
|
-
selectedIndex,
|
|
43
|
-
setSelectedIndex,
|
|
44
|
-
xAxisThickness = AxesAndRulesDefaults.xAxisThickness,
|
|
45
|
-
horizontal,
|
|
46
|
-
rtl,
|
|
47
|
-
intactTopLabel,
|
|
48
|
-
showValuesAsTopLabel,
|
|
49
|
-
topLabelContainerStyle,
|
|
50
|
-
topLabelTextStyle,
|
|
51
|
-
pointerConfig,
|
|
52
|
-
noOfSectionsBelowXAxis,
|
|
53
|
-
yAxisOffset,
|
|
54
|
-
barWidth,
|
|
55
|
-
} = props;
|
|
56
|
-
|
|
57
|
-
const barHeight = Math.max(
|
|
58
|
-
minHeight,
|
|
59
|
-
(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200) -
|
|
60
|
-
xAxisThickness,
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
commonStyleForBar,
|
|
65
|
-
barStyleWithBackground,
|
|
66
|
-
commonPropsFor2Dand3Dbars,
|
|
67
|
-
isFocused,
|
|
68
|
-
focusedBarConfig,
|
|
69
|
-
localFrontColor,
|
|
70
|
-
} = getPropsForAnimated2DWithGradient({...props, barHeight});
|
|
71
|
-
|
|
72
|
-
const itemOrPropsBarInnerComponent =
|
|
73
|
-
item.barInnerComponent ?? props.barInnerComponent;
|
|
74
|
-
const localBarInnerComponent = isFocused
|
|
75
|
-
? focusedBarConfig?.barInnerComponent ?? itemOrPropsBarInnerComponent
|
|
76
|
-
: itemOrPropsBarInnerComponent;
|
|
77
|
-
|
|
78
|
-
const barMarginBottom =
|
|
79
|
-
item.barMarginBottom === 0
|
|
80
|
-
? 0
|
|
81
|
-
: item.barMarginBottom || props.barMarginBottom || 0;
|
|
82
|
-
|
|
83
|
-
const renderLabel = (label: String, labelTextStyle: any, value: number) => {
|
|
84
|
-
return (
|
|
85
|
-
<View
|
|
86
|
-
style={[
|
|
87
|
-
{
|
|
88
|
-
width:
|
|
89
|
-
(item.labelWidth ||
|
|
90
|
-
props.labelWidth ||
|
|
91
|
-
item.barWidth ||
|
|
92
|
-
barWidth) + spacing,
|
|
93
|
-
left: spacing / -2,
|
|
94
|
-
position: 'absolute',
|
|
95
|
-
height: props.xAxisLabelsHeight ?? xAxisTextNumberOfLines * 18,
|
|
96
|
-
bottom:
|
|
97
|
-
(rotateLabel
|
|
98
|
-
? -40
|
|
99
|
-
: -6 - xAxisTextNumberOfLines * 18 - xAxisLabelsVerticalShift) -
|
|
100
|
-
barMarginBottom,
|
|
101
|
-
},
|
|
102
|
-
rotateLabel
|
|
103
|
-
? horizontal
|
|
104
|
-
? {transform: [{rotate: '330deg'}]}
|
|
105
|
-
: {
|
|
106
|
-
transform: [
|
|
107
|
-
{rotate: value < 0 ? '240deg' : '60deg'},
|
|
108
|
-
{translateX: value < 0 ? 56 : 0},
|
|
109
|
-
{translateY: value < 0 ? 32 : 0},
|
|
110
|
-
],
|
|
111
|
-
}
|
|
112
|
-
: horizontal
|
|
113
|
-
? {transform: [{rotate: '-90deg'}]}
|
|
114
|
-
: value < 0
|
|
115
|
-
? {
|
|
116
|
-
transform: [
|
|
117
|
-
{rotate: '180deg'},
|
|
118
|
-
{
|
|
119
|
-
translateY: autoShiftLabels
|
|
120
|
-
? 0
|
|
121
|
-
: 16.5 * xAxisTextNumberOfLines + 14,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
}
|
|
125
|
-
: {},
|
|
126
|
-
]}>
|
|
127
|
-
{item.labelComponent ? (
|
|
128
|
-
item.labelComponent()
|
|
129
|
-
) : (
|
|
130
|
-
<Text
|
|
131
|
-
style={[
|
|
132
|
-
{textAlign: 'center'},
|
|
133
|
-
rtl && horizontal && {transform: [{rotate: '180deg'}]},
|
|
134
|
-
labelTextStyle,
|
|
135
|
-
]}
|
|
136
|
-
numberOfLines={xAxisTextNumberOfLines}>
|
|
137
|
-
{label || ''}
|
|
138
|
-
</Text>
|
|
139
|
-
)}
|
|
140
|
-
</View>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const renderAnimatedLabel = (
|
|
145
|
-
label: String,
|
|
146
|
-
labelTextStyle: any,
|
|
147
|
-
value: number,
|
|
148
|
-
) => {
|
|
149
|
-
return (
|
|
150
|
-
<Animated.View
|
|
151
|
-
style={[
|
|
152
|
-
{
|
|
153
|
-
width:
|
|
154
|
-
(item.labelWidth ||
|
|
155
|
-
props.labelWidth ||
|
|
156
|
-
item.barWidth ||
|
|
157
|
-
barWidth) + spacing,
|
|
158
|
-
left: spacing / -2,
|
|
159
|
-
position: 'absolute',
|
|
160
|
-
height: props.xAxisLabelsHeight ?? xAxisTextNumberOfLines * 18,
|
|
161
|
-
bottom:
|
|
162
|
-
(rotateLabel
|
|
163
|
-
? -40
|
|
164
|
-
: -6 - xAxisTextNumberOfLines * 18 - xAxisLabelsVerticalShift) -
|
|
165
|
-
barMarginBottom,
|
|
166
|
-
opacity: appearingOpacity,
|
|
167
|
-
},
|
|
168
|
-
value < 0 && {transform: [{rotate: '180deg'}]},
|
|
169
|
-
rotateLabel
|
|
170
|
-
? horizontal
|
|
171
|
-
? {transform: [{rotate: '330deg'}]}
|
|
172
|
-
: {transform: [{rotate: '60deg'}]}
|
|
173
|
-
: horizontal
|
|
174
|
-
? {transform: [{rotate: '-90deg'}]}
|
|
175
|
-
: value < 0
|
|
176
|
-
? {
|
|
177
|
-
transform: [
|
|
178
|
-
{rotate: '180deg'},
|
|
179
|
-
{
|
|
180
|
-
translateY: autoShiftLabels
|
|
181
|
-
? 0
|
|
182
|
-
: 16.5 * xAxisTextNumberOfLines + 14,
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
}
|
|
186
|
-
: {},
|
|
187
|
-
]}>
|
|
188
|
-
{item.labelComponent ? (
|
|
189
|
-
item.labelComponent()
|
|
190
|
-
) : (
|
|
191
|
-
<Text
|
|
192
|
-
style={[
|
|
193
|
-
{textAlign: 'center'},
|
|
194
|
-
rtl && horizontal && {transform: [{rotate: '180deg'}]},
|
|
195
|
-
labelTextStyle,
|
|
196
|
-
]}
|
|
197
|
-
numberOfLines={xAxisTextNumberOfLines}>
|
|
198
|
-
{label || ''}
|
|
199
|
-
</Text>
|
|
200
|
-
)}
|
|
201
|
-
</Animated.View>
|
|
202
|
-
);
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
let leftSpacing = initialSpacing;
|
|
206
|
-
for (let i = 0; i < index; i++) {
|
|
207
|
-
leftSpacing +=
|
|
208
|
-
(data[i].spacing ?? propSpacing) + (data[i].barWidth || barWidth);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const static2DWithGradient = (item: barDataItem) => {
|
|
212
|
-
const localGradientColor =
|
|
213
|
-
item.gradientColor || props.gradientColor || 'white';
|
|
214
|
-
return (
|
|
215
|
-
<>
|
|
216
|
-
<LinearGradient
|
|
217
|
-
style={commonStyleForBar}
|
|
218
|
-
start={{x: 0, y: 0}}
|
|
219
|
-
end={{x: 0, y: 1}}
|
|
220
|
-
colors={[
|
|
221
|
-
isFocused
|
|
222
|
-
? focusedBarConfig?.gradientColor ?? localGradientColor
|
|
223
|
-
: localGradientColor,
|
|
224
|
-
localFrontColor,
|
|
225
|
-
]}>
|
|
226
|
-
{props.cappedBars && item.value ? (
|
|
227
|
-
<Cap
|
|
228
|
-
capThicknessFromItem={item.capThickness}
|
|
229
|
-
capThicknessFromProps={props.capThickness}
|
|
230
|
-
capColorFromItem={item.capColor}
|
|
231
|
-
capColorFromProps={props.capColor}
|
|
232
|
-
capRadiusFromItem={item.capRadius}
|
|
233
|
-
capRadiusFromProps={props.capRadius}
|
|
234
|
-
/>
|
|
235
|
-
) : null}
|
|
236
|
-
</LinearGradient>
|
|
237
|
-
{(item.barBackgroundPattern || props.barBackgroundPattern) && (
|
|
238
|
-
<BarBackgroundPattern
|
|
239
|
-
barBackgroundPatternFromItem={item.barBackgroundPattern}
|
|
240
|
-
barBackgroundPatternFromProps={props.barBackgroundPattern}
|
|
241
|
-
patternIdFromItem={item.patternId}
|
|
242
|
-
patternIdFromProps={props.patternId}
|
|
243
|
-
/>
|
|
244
|
-
)}
|
|
245
|
-
{(item.topLabelComponent || showValuesAsTopLabel) && (
|
|
246
|
-
<View
|
|
247
|
-
style={[
|
|
248
|
-
{
|
|
249
|
-
position: 'absolute',
|
|
250
|
-
top: (item.barWidth || barWidth) * -1,
|
|
251
|
-
height: item.barWidth || barWidth,
|
|
252
|
-
width: item.barWidth || barWidth,
|
|
253
|
-
justifyContent:
|
|
254
|
-
(horizontal && !intactTopLabel) || item.value < 0
|
|
255
|
-
? 'center'
|
|
256
|
-
: 'flex-end',
|
|
257
|
-
alignItems: 'center',
|
|
258
|
-
},
|
|
259
|
-
item.value < 0 && {transform: [{rotate: '180deg'}]},
|
|
260
|
-
horizontal &&
|
|
261
|
-
!intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
262
|
-
topLabelContainerStyle ?? item.topLabelContainerStyle,
|
|
263
|
-
]}>
|
|
264
|
-
{showValuesAsTopLabel ? (
|
|
265
|
-
<Text style={topLabelTextStyle}>{item.value + yAxisOffset}</Text>
|
|
266
|
-
) : (
|
|
267
|
-
item.topLabelComponent?.()
|
|
268
|
-
)}
|
|
269
|
-
</View>
|
|
270
|
-
)}
|
|
271
|
-
{localBarInnerComponent ? (
|
|
272
|
-
<View style={{height: '100%', width: '100%'}}>
|
|
273
|
-
{localBarInnerComponent(item, index)}
|
|
274
|
-
</View>
|
|
275
|
-
) : null}
|
|
276
|
-
</>
|
|
277
|
-
);
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
const barWrapperStyle = [
|
|
281
|
-
{
|
|
282
|
-
// overflow: 'visible',
|
|
283
|
-
marginBottom: 60 + barMarginBottom + xAxisLabelsVerticalShift - 0.5,
|
|
284
|
-
width: commonPropsFor2Dand3Dbars.barWidth,
|
|
285
|
-
height: barHeight,
|
|
286
|
-
marginRight: spacing,
|
|
287
|
-
},
|
|
288
|
-
|
|
289
|
-
pointerConfig
|
|
290
|
-
? {
|
|
291
|
-
transform: [
|
|
292
|
-
{
|
|
293
|
-
translateY:
|
|
294
|
-
(containerHeight || 200) -
|
|
295
|
-
(barHeight - 10 + xAxisLabelsVerticalShift) +
|
|
296
|
-
(item.value < 0
|
|
297
|
-
? (Math.abs(item.value) * (containerHeight || 200)) /
|
|
298
|
-
(maxValue || 200)
|
|
299
|
-
: 0),
|
|
300
|
-
},
|
|
301
|
-
],
|
|
302
|
-
}
|
|
303
|
-
: item.value < 0
|
|
304
|
-
? {
|
|
305
|
-
transform: [
|
|
306
|
-
{
|
|
307
|
-
translateY:
|
|
308
|
-
(Math.abs(item.value) * (containerHeight || 200)) /
|
|
309
|
-
(maxValue || 200),
|
|
310
|
-
},
|
|
311
|
-
{rotateZ: '180deg'},
|
|
312
|
-
],
|
|
313
|
-
}
|
|
314
|
-
: null,
|
|
315
|
-
side !== 'right' && {zIndex: data.length - index},
|
|
316
|
-
];
|
|
317
|
-
|
|
318
|
-
const pressDisabled =
|
|
319
|
-
item.disablePress ||
|
|
320
|
-
props.disablePress ||
|
|
321
|
-
(pointerConfig && pointerConfig.barTouchable !== true);
|
|
322
|
-
|
|
323
|
-
const barContent = () => {
|
|
324
|
-
const isBarBelowXaxisAndInvisible =
|
|
325
|
-
item.value < 0 && !noOfSectionsBelowXAxis;
|
|
326
|
-
const animated2DWithGradient = (noGradient, noAnimation) => (
|
|
327
|
-
<Animated2DWithGradient
|
|
328
|
-
{...commonPropsFor2Dand3Dbars}
|
|
329
|
-
animationDuration={animationDuration || 800}
|
|
330
|
-
roundedBottom={props.roundedBottom || false}
|
|
331
|
-
roundedTop={props.roundedTop || false}
|
|
332
|
-
noGradient={noGradient}
|
|
333
|
-
noAnimation={noAnimation}
|
|
334
|
-
containerHeight={containerHeight}
|
|
335
|
-
maxValue={maxValue}
|
|
336
|
-
minHeight={minHeight ?? 0}
|
|
337
|
-
barMarginBottom={barMarginBottom}
|
|
338
|
-
cappedBars={props.cappedBars}
|
|
339
|
-
capThickness={props.capThickness}
|
|
340
|
-
capColor={props.capColor}
|
|
341
|
-
capRadius={props.capRadius}
|
|
342
|
-
horizontal={horizontal}
|
|
343
|
-
barBorderWidth={barBorderWidth}
|
|
344
|
-
barBorderColor={barBorderColor}
|
|
345
|
-
commonStyleForBar={commonStyleForBar}
|
|
346
|
-
barStyleWithBackground={barStyleWithBackground}
|
|
347
|
-
/>
|
|
348
|
-
);
|
|
349
|
-
return (
|
|
350
|
-
<>
|
|
351
|
-
{(props.showXAxisIndices || item.showXAxisIndex) && (
|
|
352
|
-
<View
|
|
353
|
-
style={{
|
|
354
|
-
zIndex: 2,
|
|
355
|
-
position: 'absolute',
|
|
356
|
-
height: props.xAxisIndicesHeight,
|
|
357
|
-
width: props.xAxisIndicesWidth,
|
|
358
|
-
bottom: props.xAxisIndicesHeight / -2,
|
|
359
|
-
left: ((item.barWidth || barWidth) - props.xAxisIndicesWidth) / 2,
|
|
360
|
-
backgroundColor: props.xAxisIndicesColor,
|
|
361
|
-
}}
|
|
362
|
-
/>
|
|
363
|
-
)}
|
|
364
|
-
{isBarBelowXaxisAndInvisible ? null : isThreeD ? (
|
|
365
|
-
<AnimatedThreeDBar
|
|
366
|
-
{...commonPropsFor2Dand3Dbars}
|
|
367
|
-
sideWidth={
|
|
368
|
-
item.sideWidth ||
|
|
369
|
-
props.sideWidth ||
|
|
370
|
-
(item.barWidth || barWidth) / 2
|
|
371
|
-
}
|
|
372
|
-
side={side || 'left'}
|
|
373
|
-
sideColor={item.sideColor || props.sideColor || ''}
|
|
374
|
-
topColor={item.topColor || props.topColor || ''}
|
|
375
|
-
horizontal={horizontal}
|
|
376
|
-
isAnimated={isAnimated}
|
|
377
|
-
animationDuration={animationDuration || 800}
|
|
378
|
-
selectedIndex={selectedIndex}
|
|
379
|
-
/>
|
|
380
|
-
) : item.showGradient || props.showGradient ? (
|
|
381
|
-
isAnimated ? (
|
|
382
|
-
animated2DWithGradient(false, false)
|
|
383
|
-
) : (
|
|
384
|
-
static2DWithGradient(item)
|
|
385
|
-
)
|
|
386
|
-
) : isAnimated ? (
|
|
387
|
-
animated2DWithGradient(true, false)
|
|
388
|
-
) : (
|
|
389
|
-
animated2DWithGradient(true, true)
|
|
390
|
-
)}
|
|
391
|
-
{isAnimated
|
|
392
|
-
? renderAnimatedLabel(label, labelTextStyle, item.value)
|
|
393
|
-
: renderLabel(label, labelTextStyle, item.value)}
|
|
394
|
-
</>
|
|
395
|
-
);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
return (
|
|
399
|
-
<>
|
|
400
|
-
{pressDisabled ? (
|
|
401
|
-
<View pointerEvents="none" style={barWrapperStyle}>
|
|
402
|
-
{barContent()}
|
|
403
|
-
</View>
|
|
404
|
-
) : (
|
|
405
|
-
<TouchableOpacity
|
|
406
|
-
activeOpacity={props.activeOpacity || 0.2}
|
|
407
|
-
onPress={() => {
|
|
408
|
-
if (renderTooltip || props.focusBarOnPress) {
|
|
409
|
-
setSelectedIndex(index);
|
|
410
|
-
}
|
|
411
|
-
item.onPress
|
|
412
|
-
? item.onPress()
|
|
413
|
-
: props.onPress
|
|
414
|
-
? props.onPress(item, index)
|
|
415
|
-
: null;
|
|
416
|
-
}}
|
|
417
|
-
onLongPress={() => {
|
|
418
|
-
item.onLongPress
|
|
419
|
-
? item.onLongPress()
|
|
420
|
-
: props.onLongPress
|
|
421
|
-
? props.onLongPress(item, index)
|
|
422
|
-
: null;
|
|
423
|
-
}}
|
|
424
|
-
onPressOut={() => {
|
|
425
|
-
item.onPressOut
|
|
426
|
-
? item.onPressOut()
|
|
427
|
-
: props.onPressOut
|
|
428
|
-
? props.onPressOut(item, index)
|
|
429
|
-
: null;
|
|
430
|
-
}}
|
|
431
|
-
style={barWrapperStyle}>
|
|
432
|
-
{barContent()}
|
|
433
|
-
</TouchableOpacity>
|
|
434
|
-
)}
|
|
435
|
-
{renderTooltip && selectedIndex === index && (
|
|
436
|
-
<View
|
|
437
|
-
style={{
|
|
438
|
-
position: 'absolute',
|
|
439
|
-
bottom: barHeight + 60,
|
|
440
|
-
left:
|
|
441
|
-
index === data.length - 1
|
|
442
|
-
? leftSpacing - leftShiftForLastIndexTooltip
|
|
443
|
-
: leftSpacing -
|
|
444
|
-
(item?.leftShiftForTooltip ?? leftShiftForTooltip ?? 0),
|
|
445
|
-
zIndex: 1000,
|
|
446
|
-
}}>
|
|
447
|
-
{renderTooltip(item, index)}
|
|
448
|
-
</View>
|
|
449
|
-
)}
|
|
450
|
-
</>
|
|
451
|
-
);
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
export default RenderBars;
|