Skip to content

Commit 8ff792b

Browse files
committed
migrate deprecated View.propTypes and React.PropTypes
1 parent c88e68f commit 8ff792b

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
*/
88

99
import React, {Component} from 'react';
10+
import PropTypes from 'prop-types';
1011
import {
1112
StyleSheet,
1213
View,
1314
Animated,
1415
Dimensions,
1516
Text,
17+
ViewPropTypes as RNViewPropTypes,
1618
} from 'react-native'
1719

20+
const ViewPropTypes = RNViewPropTypes || View.propTypes;
21+
1822
export const DURATION = {
1923
LENGTH_LONG: 2000,
2024
LENGTH_SHORT: 500,
@@ -129,17 +133,17 @@ const styles = StyleSheet.create({
129133
});
130134

131135
Toast.propTypes = {
132-
style: View.propTypes.style,
133-
position: React.PropTypes.oneOf([
136+
style: ViewPropTypes.style,
137+
position: PropTypes.oneOf([
134138
'top',
135139
'center',
136140
'bottom',
137141
]),
138142
textStyle: Text.propTypes.style,
139-
positionValue: React.PropTypes.number,
140-
fadeInDuration: React.PropTypes.number,
141-
fadeOutDuration: React.PropTypes.number,
142-
opacity: React.PropTypes.number
143+
positionValue: PropTypes.number,
144+
fadeInDuration: PropTypes.number,
145+
fadeOutDuration: PropTypes.number,
146+
opacity: PropTypes.number
143147
}
144148

145149
Toast.defaultProps = {

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
"peerDependencies": {
3131
"react-native": ">=0.20.0"
3232
},
33-
"homepage": "https://github.com/crazycodeboy/react-native-easy-toast#readme"
33+
"homepage": "https://github.com/crazycodeboy/react-native-easy-toast#readme",
34+
"dependencies": {
35+
"prop-types": "^15.5.10"
36+
}
3437
}

0 commit comments

Comments
 (0)