Skip to content

update the default props and proptypes due to proposal-class-properties #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
30 changes: 16 additions & 14 deletions src/components/ball-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ import { View, Animated } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class BallIndicator extends PureComponent {
static defaultProps = {
color: 'rgb(0, 0, 0)',
count: 8,
size: 40,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

class BallIndicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -84,3 +71,18 @@ export default class BallIndicator extends PureComponent {
);
}
}

BallIndicator.defaultProps = {
color: 'rgb(0, 0, 0)',
count: 8,
size: 40,
};

BallIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

export default BallIndicator;
32 changes: 17 additions & 15 deletions src/components/bar-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@ import { View, Animated } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class BarIndicator extends PureComponent {
static defaultProps = {
count: 3,

color: 'rgb(0, 0, 0)',
size: 40,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

class BarIndicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -112,3 +98,19 @@ export default class BarIndicator extends PureComponent {
);
}
}

BarIndicator.defaultProps = {
count: 3,

color: 'rgb(0, 0, 0)',
size: 40,
};

BarIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

export default BarIndicator;
34 changes: 18 additions & 16 deletions src/components/dot-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,7 @@ import { Animated, Easing } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class DotIndicator extends PureComponent {
static defaultProps = {
animationEasing: Easing.inOut(Easing.ease),

color: 'rgb(0, 0, 0)',
count: 4,
size: 16,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

class DotIndicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -73,3 +58,20 @@ export default class DotIndicator extends PureComponent {
);
}
}

DotIndicator.defaultProps = {
animationEasing: Easing.inOut(Easing.ease),

color: 'rgb(0, 0, 0)',
count: 4,
size: 16,
};

DotIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

export default DotIndicator;
47 changes: 25 additions & 22 deletions src/components/indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,7 @@ import RN from 'react-native/package';
const [major, minor] = RN.version.split('.').map((item) => Number(item));
const hasLoopSupport = !major && minor >= 45;

export default class Indicator extends PureComponent {
static defaultProps = {
animationEasing: Easing.linear,
animationDuration: 1200,

animating: true,
interaction: true,

count: 1,
};

static propTypes = {
animationEasing: PropTypes.func,
animationDuration: PropTypes.number,

animating: PropTypes.bool,
interaction: PropTypes.bool,

renderComponent: PropTypes.func,
count: PropTypes.number,
};

class Indicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -134,3 +113,27 @@ export default class Indicator extends PureComponent {
);
}
}


Indicator.defaultProps = {
animationEasing: Easing.linear,
animationDuration: 1200,

animating: true,
interaction: true,

count: 1,
};

Indicator.propTypes = {
animationEasing: PropTypes.func,
animationDuration: PropTypes.number,

animating: PropTypes.bool,
interaction: PropTypes.bool,

renderComponent: PropTypes.func,
count: PropTypes.number,
};

export default Indicator;
33 changes: 18 additions & 15 deletions src/components/material-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@ import { View, Animated, Easing } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class MaterialIndicator extends PureComponent {
static defaultProps = {
animationDuration: 2400,

color: 'rgb(0, 0, 0)',
size: 40,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

class MaterialIndicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -122,3 +108,20 @@ export default class MaterialIndicator extends PureComponent {
);
}
}


MaterialIndicator.defaultProps = {
animationDuration: 2400,

color: 'rgb(0, 0, 0)',
size: 40,
};

MaterialIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

export default MaterialIndicator;
32 changes: 17 additions & 15 deletions src/components/pacman-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@ import { View, Animated, I18nManager } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class PacmanIndicator extends PureComponent {
static defaultProps = {
animationDuration: 600,

color: 'rgb(0, 0, 0)',
size: 48,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

class PacmanIndicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -131,3 +117,19 @@ export default class PacmanIndicator extends PureComponent {
);
}
}

PacmanIndicator.defaultProps = {
animationDuration: 600,

color: 'rgb(0, 0, 0)',
size: 48,
};

PacmanIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

export default PacmanIndicator;
38 changes: 17 additions & 21 deletions src/components/pulse-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,7 @@ import { View, Animated, Easing } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class PulseIndicator extends PureComponent {
static defaultProps = {
animationEasing: Easing.out(Easing.ease),

color: 'rgb(0, 0, 0)',
size: 40,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,
};

constructor(props) {
super(props);

this.renderComponent = this.renderComponent.bind(this);
}

class PulseIndicator extends PureComponent {
renderComponent({ index, count, progress }) {
let { size, color } = this.props;

Expand Down Expand Up @@ -72,3 +52,19 @@ export default class PulseIndicator extends PureComponent {
);
}
}

PulseIndicator.defaultProps = {
animationEasing: Easing.out(Easing.ease),

color: "rgb(0, 0, 0)",
size: 40
};

PulseIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number
};

export default PulseIndicator;
47 changes: 25 additions & 22 deletions src/components/skype-indicator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,7 @@ import { View, Animated, Easing } from 'react-native';
import Indicator from '../indicator';
import styles from './styles';

export default class SkypeIndicator extends PureComponent {
static defaultProps = {
animationDuration: 1600,

color: 'rgb(0, 0, 0)',
count: 5,
size: 40,

minScale: 0.2,
maxScale: 1.0,
};

static propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,

minScale: PropTypes.number,
maxScale: PropTypes.number,
};

class SkypeIndicator extends PureComponent {
constructor(props) {
super(props);

Expand Down Expand Up @@ -88,3 +67,27 @@ export default class SkypeIndicator extends PureComponent {
);
}
}


SkypeIndicator.defaultProps = {
animationDuration: 1600,

color: "rgb(0, 0, 0)",
count: 5,
size: 40,

minScale: 0.2,
maxScale: 1.0
};

SkypeIndicator.propTypes = {
...Indicator.propTypes,

color: PropTypes.string,
size: PropTypes.number,

minScale: PropTypes.number,
maxScale: PropTypes.number
};

export default SkypeIndicator;
Loading