Skip to content

Commit 7b4147e

Browse files
Merge pull request #14 from zenz/master
Fix Indicator issues.
2 parents 9f2cf7c + 4241421 commit 7b4147e

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Speedometer = (props) => {
3434
) : null;
3535

3636
return (
37-
<View style={style}>
37+
<View style={[styles.content, style]}>
3838
<View style={[styles.outerCircle, outerCircleStyle]}>
3939
<View style={[styles.halfCircle, halfCircleStyle]}/>
4040
<View style={[styles.innerCircle, innerCircleStyle]}>

src/rules.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import color from 'color';
22

3-
export const getStyles = ({ size, percentSize, internalColor, innerColor, outerColor, indicatorColor }, degrees, degreesValue) => ({
3+
export const getStyles = ({ size, percentSize, internalColor, innerColor, outerColor, indicatorColor, showIndicator }, degrees, degreesValue) => ({
44
outerCircle: {
55
justifyContent: 'flex-end',
66
alignItems: 'center',
@@ -55,15 +55,22 @@ export const getStyles = ({ size, percentSize, internalColor, innerColor, outerC
5555
height: 4,
5656
zIndex: 1000,
5757
justifyContent: 'center',
58-
transform: [{ translateX: (2 + size) / 4 }, { rotate: `${((180 / 100) * degreesValue)}deg` }, { translateX: ( (2 + size) / 4 * -1) }],
59-
width: 2 + size / 2,
58+
transform: [{ translateX: size / 4 }, { rotate: `${(degrees + 90)}deg` }, { translateX: (size / 4 * -1) }],
59+
width: size / 2,
6060
backgroundColor: indicatorColor,
61+
position: 'absolute',
62+
left: 0,
63+
top: (size / 2) - 2,
6164
},
6265
pointIndicator: {
6366
borderRadius: 50,
6467
width: 15,
6568
height: 15,
6669
alignSelf: 'flex-end',
70+
transform: [{ translateX: 7.5 }],
6771
backgroundColor: color(indicatorColor).darken(0.2).hex(),
6872
},
73+
content: (showIndicator) ? {
74+
marginBottom: 10,
75+
} : null,
6976
});

0 commit comments

Comments
 (0)