Skip to content

Commit fce0e1a

Browse files
jonkessleroblador
authored andcommitted
Use ViewPropTypes instead of View.propTypes, as it is deprecated. Fall back if not available. (#70)
1 parent c32ee28 commit fce0e1a

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

Bar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import {
44
Animated,
55
Easing,
66
View,
7+
ViewPropTypes,
78
} from 'react-native';
89

910
const INDETERMINATE_WIDTH_FACTOR = 0.3;
1011
const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_WIDTH_FACTOR);
1112

13+
const RNViewPropTypes = ViewPropTypes || View.propTypes;
14+
1215
export default class ProgressBar extends Component {
1316
static propTypes = {
1417
animated: PropTypes.bool,
@@ -21,7 +24,7 @@ export default class ProgressBar extends Component {
2124
indeterminate: PropTypes.bool,
2225
onLayout: PropTypes.func,
2326
progress: PropTypes.number,
24-
style: View.propTypes.style,
27+
style: RNViewPropTypes.style,
2528
unfilledColor: PropTypes.string,
2629
width: PropTypes.number,
2730
};

Circle.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
StyleSheet,
77
Text,
88
View,
9+
ViewPropTypes,
910
} from 'react-native';
1011

1112
import Arc from './Shapes/Arc';
@@ -16,6 +17,8 @@ const CIRCLE = Math.PI * 2;
1617
const AnimatedSurface = Animated.createAnimatedComponent(ART.Surface);
1718
const AnimatedArc = Animated.createAnimatedComponent(Arc);
1819

20+
const RNViewPropTypes = ViewPropTypes || View.propTypes;
21+
1922
const styles = StyleSheet.create({
2023
container: {
2124
backgroundColor: 'transparent',
@@ -40,7 +43,7 @@ export class ProgressCircle extends Component {
4043
rotation: PropTypes.instanceOf(Animated.Value),
4144
showsText: PropTypes.bool,
4245
size: PropTypes.number,
43-
style: View.propTypes.style,
46+
style: RNViewPropTypes.style,
4447
textStyle: Text.propTypes.style,
4548
thickness: PropTypes.number,
4649
unfilledColor: PropTypes.string,

CircleSnail.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ART,
66
Easing,
77
View,
8+
ViewPropTypes,
89
} from 'react-native';
910

1011
import Arc from './Shapes/Arc';
@@ -14,6 +15,8 @@ const AnimatedArc = Animated.createAnimatedComponent(Arc);
1415
const MIN_ARC_ANGLE = 0.1;
1516
const MAX_ARC_ANGLE = 1.5 * Math.PI;
1617

18+
const RNViewPropTypes = ViewPropTypes || View.propTypes;
19+
1720
export default class CircleSnail extends Component {
1821
static propTypes = {
1922
animating: PropTypes.bool,
@@ -27,7 +30,7 @@ export default class CircleSnail extends Component {
2730
hidesWhenStopped: PropTypes.bool,
2831
size: PropTypes.number,
2932
spinDuration: PropTypes.number,
30-
style: View.propTypes.style,
33+
style: RNViewPropTypes.style,
3134
thickness: PropTypes.number,
3235
strokeCap: PropTypes.string
3336
};

Pie.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ART,
66
StyleSheet,
77
View,
8+
ViewPropTypes,
89
} from 'react-native';
910

1011
import Circle from './Shapes/Circle';
@@ -16,6 +17,8 @@ const CIRCLE = Math.PI * 2;
1617
const AnimatedSurface = Animated.createAnimatedComponent(ART.Surface);
1718
const AnimatedSector = Animated.createAnimatedComponent(Sector);
1819

20+
const RNViewPropTypes = ViewPropTypes || View.propTypes;
21+
1922
const styles = StyleSheet.create({
2023
container: {
2124
backgroundColor: 'transparent',
@@ -36,7 +39,7 @@ export class ProgressPie extends Component {
3639
]),
3740
rotation: PropTypes.instanceOf(Animated.Value),
3841
size: PropTypes.number,
39-
style: View.propTypes.style,
42+
style: RNViewPropTypes.style,
4043
unfilledColor: PropTypes.string,
4144
};
4245

0 commit comments

Comments
 (0)