Skip to content

Commit 0c0c955

Browse files
authored
Merge pull request #81 from alex4dev/useNativeDriver
add useNativeAnimation prop
2 parents 7eaeb78 + 23c4d19 commit 0c0c955

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818

1919
import PropTypes from 'prop-types';
2020
const ViewPropTypes = RNViewPropTypes || View.propTypes;
21-
export const DURATION = {
21+
export const DURATION = {
2222
LENGTH_SHORT: 500,
2323
FOREVER: 0,
2424
};
@@ -49,6 +49,7 @@ export default class Toast extends Component {
4949
{
5050
toValue: this.props.opacity,
5151
duration: this.props.fadeInDuration,
52+
useNativeDriver: this.props.useNativeAnimation
5253
}
5354
)
5455
this.animation.start(() => {
@@ -70,6 +71,7 @@ export default class Toast extends Component {
7071
{
7172
toValue: 0.0,
7273
duration: this.props.fadeOutDuration,
74+
useNativeDriver: this.props.useNativeAnimation
7375
}
7476
)
7577
this.animation.start(() => {
@@ -148,7 +150,8 @@ Toast.propTypes = {
148150
positionValue:PropTypes.number,
149151
fadeInDuration:PropTypes.number,
150152
fadeOutDuration:PropTypes.number,
151-
opacity:PropTypes.number
153+
opacity:PropTypes.number,
154+
useNativeAnimation:PropTypes.bool
152155
}
153156

154157
Toast.defaultProps = {
@@ -157,5 +160,6 @@ Toast.defaultProps = {
157160
positionValue: 120,
158161
fadeInDuration: 500,
159162
fadeOutDuration: 500,
160-
opacity: 1
163+
opacity: 1,
164+
useNativeAnimation: false
161165
}

0 commit comments

Comments
 (0)