Skip to content

Commit

Permalink
Added dot size prop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvcasillas committed Jun 17, 2019
1 parent d802bc1 commit 1269611
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,13 @@ This prop will change the number of dots that will be displayed in the animation
default ["#4dabf7", "#3bc9db", "#38d9a9", "#69db7c"]
```

This prop will change the color of the dots in the given array order. If you declare the array but the length doesn't match with the amount of dots defined, the dot that cannot take a color from this array will instead use a fallback color of `"#4dabf7"`.
This prop will change the color of the dots in the given array order. If you declare the array but the length doesn't match with the amount of dots defined, the dot that cannot take a color from this array will instead use a fallback color of `"#4dabf7"`.

### size

```js
@type {Number}
default 20
```

This prop will control the size of each dot that will be displayed for the animation.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-loading-dots",
"version": "1.0.6",
"version": "1.0.7",
"description": "A React Native loading component with dots and smooth animation",
"repository": "https://github.com/alexvcasillas/react-native-loading-dots",
"author": "Alex Casillas",
Expand Down
9 changes: 2 additions & 7 deletions src/react-native-loading-dots.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const defaultColors = [
"#69db7c"
];

function LoadingDots({ dots = 4, colors = defaultColors }) {
function LoadingDots({ dots = 4, colors = defaultColors, size = 20 }) {
const [animations, setAnimations] = useState([]);
const [reverse, setReverse] = useState(false);

Expand Down Expand Up @@ -80,7 +80,7 @@ function LoadingDots({ dots = 4, colors = defaultColors }) {
// eslint-disable-next-line react/no-array-index-key
key={`loading-anim-${index}`}
style={[
styles.dot,
{ width: size, height: size, borderRadius: size / 10 },
{ backgroundColor: colors[index] || "#4dabf7" },
{ transform: [{ translateY: animation }] }
]}
Expand All @@ -96,11 +96,6 @@ const styles = StyleSheet.create({
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between"
},
dot: {
width: 20,
height: 20,
borderRadius: 10
}
});

Expand Down

0 comments on commit 1269611

Please sign in to comment.