Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Customize the number of dots, animation speed, and style using these props:
| **`animationDelay`** | The length in milliseconds of each phase of the animated. Defaults to **300**. |
| **`minOpacity`** | The minimum opacity for the dots. Defaults to **0**. |
| **`style`** | CSS to apply to the dots. It accepts any styles that a normal `<Text />` component can take. |
| **`useNativeDriver`** | Specify true or false. Defaults to **true**. |


## More Examples
Expand Down
13 changes: 8 additions & 5 deletions src/AnimatedEllipsis.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Text, Animated, View, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { Text, Animated, View, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';


export default class AnimatedEllipsis extends Component {
Expand All @@ -9,6 +9,7 @@ export default class AnimatedEllipsis extends Component {
animationDelay: PropTypes.number,
minOpacity: PropTypes.number,
style: Text.propTypes.style,
useNativeDriver: PropTypes.bool
};

static defaultProps = {
Expand All @@ -18,7 +19,8 @@ export default class AnimatedEllipsis extends Component {
style: {
color: '#aaa',
fontSize: 32,
}
},
useNativeDriver: true
};

constructor(props) {
Expand Down Expand Up @@ -66,10 +68,11 @@ export default class AnimatedEllipsis extends Component {
Animated.timing(this._animation_state.dot_opacities[which_dot], {
toValue: this._animation_state.target_opacity,
duration: this.props.animationDelay,
useNativeDriver: this.props.useNativeDriver,
}).start(this.animate_dots.bind(this, next_dot));
}

render () {
render() {
let dots = this._animation_state.dot_opacities.map((o, i) =>
<Animated.Text key={i} style={[this.props.style, { opacity: o }]}>
{' '}
Expand Down