Skip to content

Commit 88acf7b

Browse files
authored
Merge branch 'master' into master
2 parents 3edcef5 + 6fd5a5f commit 88acf7b

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

README.zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ textStyle | View.propTypes.style | true | {color:'white'} | 自定义text的
135135

136136

137137
方法 | 类型 | 可选 | 描述
138-
----------------- | -------- | -------- | -----------
138+
----------------- | -------- | -------- | ----------- | -----------
139139
show(text, duration) | function | false | 弹出提示框,单位是毫秒
140140
close() | function | true | 手动关闭提示框
141141

index.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
* react-native-easy-toast
33
* https://github.com/crazycodeboy/react-native-easy-toast
44
* Email:crazycodeboy@gmail.com
5-
* Blog:http://www.devio.org/
5+
* Blog:http://jiapenghui.com
66
* @flow
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

1820
import PropTypes from 'prop-types';
19-
21+
const ViewPropTypes = RNViewPropTypes || View.propTypes;
2022
export const DURATION = {
21-
LENGTH_LONG: 2000,
2223
LENGTH_SHORT: 500,
2324
FOREVER: 0,
2425
};
@@ -101,15 +102,15 @@ export default class Toast extends Component {
101102
pos = height - this.props.positionValue;
102103
break;
103104
}
104-
105+
105106
const view = this.state.isShow ?
106107
<View
107108
style={[styles.container, { top: pos }]}
108109
pointerEvents="none"
109-
>
110+
>
110111
<Animated.View
111112
style={[styles.content, { opacity: this.state.opacityValue }, this.props.style]}
112-
>
113+
>
113114
<Text style={this.props.textStyle}>{this.state.text}</Text>
114115
</Animated.View>
115116
</View> : null;
@@ -122,7 +123,9 @@ const styles = StyleSheet.create({
122123
position: 'absolute',
123124
left: 0,
124125
right: 0,
126+
elevation: 999,
125127
alignItems: 'center',
128+
zIndex: 10000,
126129
},
127130
content: {
128131
backgroundColor: 'black',
@@ -135,17 +138,17 @@ const styles = StyleSheet.create({
135138
});
136139

137140
Toast.propTypes = {
138-
style: PropTypes.any,
141+
style: ViewPropTypes.style,
139142
position: PropTypes.oneOf([
140143
'top',
141144
'center',
142145
'bottom',
143146
]),
144-
textStyle: PropTypes.any,
145-
positionValue: PropTypes.number,
146-
fadeInDuration: PropTypes.number,
147-
fadeOutDuration: PropTypes.number,
148-
opacity: PropTypes.number
147+
textStyle: Text.propTypes.style,
148+
positionValue:PropTypes.number,
149+
fadeInDuration:PropTypes.number,
150+
fadeOutDuration:PropTypes.number,
151+
opacity:PropTypes.number
149152
}
150153

151154
Toast.defaultProps = {

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-easy-toast",
3-
"version": "1.0.6",
3+
"version": "1.0.9",
44
"description": "A react native module to show toast like android, it works on iOS and Android.",
55
"main": "index.js",
66
"scripts": {
@@ -31,7 +31,11 @@
3131
"prop-types": "^15.6.0"
3232
},
3333
"peerDependencies": {
34-
"react-native": ">=0.20.0"
34+
"react-native": ">=0.20.0",
35+
"prop-types": "^15.5.7"
3536
},
36-
"homepage": "https://github.com/crazycodeboy/react-native-easy-toast#readme"
37+
"homepage": "https://github.com/crazycodeboy/react-native-easy-toast#readme",
38+
"dependencies": {
39+
"prop-types": "^15.5.10"
40+
}
3741
}

0 commit comments

Comments
 (0)