Skip to content

Commit 3bacaff

Browse files
author
Ionut Mocanu
committed
Update README.MD
1 parent 925a24c commit 3bacaff

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ render() {
9494
ref="toast"
9595
style={{backgroundColor:'red'}}
9696
position='top'
97+
positionValue={200}
98+
fadeInDuration={750}
99+
fadeOutDuration={1000}
100+
opacity={0.8}
97101
textStyle={{color:'red'}}
98102
/>
99103
</View>
@@ -114,13 +118,17 @@ Props | Type | Optional | Default | Description
114118
----------------- | -------- | -------- | ----------- | -----------
115119
style | View.propTypes.style | true | {backgroundColor: 'black',opacity: OPACITY,borderRadius: 5,padding: 10,} | Custom style toast
116120
position | PropTypes.oneOf(['top','center','bottom',]) |true | 'bottom' | Custom toast position
121+
positionValue | React.PropTypes.number | true | 120 | Custom toast position value
122+
fadeInDuration | React.PropTypes.number | true | 500 | Custom toast show duration
123+
fadeOutDuration | React.PropTypes.number | true | 500 | Custom toast close duration
124+
opacity | React.PropTypes.number | true | 1 | Custom toast opacity
117125
textStyle | View.propTypes.style | true | {color:'white'} | Custom style text
118126

119127

120128
Method | Type | Optional | Description
121129
----------------- | -------- | -------- | ----------- | -----------
122130
show(text, duration) | function | false | show a toast,unit is millisecond
123-
close(instantly) | function | true | pass true to close instantly, empty or false to start the close timer
131+
close() | function | - | start the close timer
124132

125133

126134
## Contribution

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Dimensions,
1515
Text,
1616
} from 'react-native'
17-
export const DURATION = { LENGTH_LONG: 2000, LENGTH_SHORT: 1000 };
17+
export const DURATION = { LENGTH_LONG: 2000, LENGTH_SHORT: 500 };
1818
const {height, width} = Dimensions.get('window');
1919

2020
export default class Toast extends Component {
@@ -49,7 +49,7 @@ export default class Toast extends Component {
4949

5050
close() {
5151
let delay = this.duration;
52-
52+
5353
if (!this.isShow) return;
5454
this.timer && clearTimeout(this.timer);
5555
this.timer = setTimeout(() => {
@@ -126,8 +126,8 @@ Toast.propTypes = {
126126
]),
127127
textStyle: Text.propTypes.style,
128128
positionValue: React.PropTypes.number,
129-
showDuration: React.PropTypes.number,
130-
visibleDuration: React.PropTypes.number,
129+
fadeInDuration: React.PropTypes.number,
130+
fadeOutDuration: React.PropTypes.number,
131131
opacity: React.PropTypes.number
132132
}
133133

0 commit comments

Comments
 (0)