Skip to content

Commit

Permalink
add useNativeAnimation prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre committed Aug 5, 2019
1 parent 7eaeb78 commit 23c4d19
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {

import PropTypes from 'prop-types';
const ViewPropTypes = RNViewPropTypes || View.propTypes;
export const DURATION = {
export const DURATION = {
LENGTH_SHORT: 500,
FOREVER: 0,
};
Expand Down Expand Up @@ -49,6 +49,7 @@ export default class Toast extends Component {
{
toValue: this.props.opacity,
duration: this.props.fadeInDuration,
useNativeDriver: this.props.useNativeAnimation
}
)
this.animation.start(() => {
Expand All @@ -70,6 +71,7 @@ export default class Toast extends Component {
{
toValue: 0.0,
duration: this.props.fadeOutDuration,
useNativeDriver: this.props.useNativeAnimation
}
)
this.animation.start(() => {
Expand Down Expand Up @@ -148,7 +150,8 @@ Toast.propTypes = {
positionValue:PropTypes.number,
fadeInDuration:PropTypes.number,
fadeOutDuration:PropTypes.number,
opacity:PropTypes.number
opacity:PropTypes.number,
useNativeAnimation:PropTypes.bool
}

Toast.defaultProps = {
Expand All @@ -157,5 +160,6 @@ Toast.defaultProps = {
positionValue: 120,
fadeInDuration: 500,
fadeOutDuration: 500,
opacity: 1
opacity: 1,
useNativeAnimation: false
}

0 comments on commit 23c4d19

Please sign in to comment.