@@ -20,6 +20,7 @@ import {
20
20
const ActionButton = props => {
21
21
const [ , setResetToken ] = useState ( props . resetToken ) ;
22
22
const [ active , setActive ] = useState ( props . active ) ;
23
+ const useNativeDriver = props . useNativeDriver || false ;
23
24
const anim = useRef ( new Animated . Value ( props . active ? 1 : 0 ) ) ;
24
25
const timeout = useRef ( null ) ;
25
26
const mounted = useRef ( false ) ;
@@ -35,13 +36,13 @@ const ActionButton = props => {
35
36
36
37
useEffect ( ( ) => {
37
38
if ( props . active ) {
38
- Animated . spring ( anim . current , { toValue : 1 } ) . start ( ) ;
39
+ Animated . spring ( anim . current , { toValue : 1 , useNativeDriver } ) . start ( ) ;
39
40
setActive ( true ) ;
40
41
setResetToken ( props . resetToken ) ;
41
42
} else {
42
43
props . onReset && props . onReset ( ) ;
43
44
44
- Animated . spring ( anim . current , { toValue : 0 } ) . start ( ) ;
45
+ Animated . spring ( anim . current , { toValue : 0 , useNativeDriver } ) . start ( ) ;
45
46
timeout . current = setTimeout ( ( ) => {
46
47
setActive ( false ) ;
47
48
setResetToken ( props . resetToken ) ;
@@ -254,7 +255,7 @@ const ActionButton = props => {
254
255
if ( active ) return reset ( animate ) ;
255
256
256
257
if ( animate ) {
257
- Animated . spring ( anim . current , { toValue : 1 } ) . start ( ) ;
258
+ Animated . spring ( anim . current , { toValue : 1 , useNativeDriver } ) . start ( ) ;
258
259
} else {
259
260
anim . current . setValue ( 1 ) ;
260
261
}
@@ -266,7 +267,7 @@ const ActionButton = props => {
266
267
if ( props . onReset ) props . onReset ( ) ;
267
268
268
269
if ( animate ) {
269
- Animated . spring ( anim . current , { toValue : 0 } ) . start ( ) ;
270
+ Animated . spring ( anim . current , { toValue : 0 , useNativeDriver } ) . start ( ) ;
270
271
} else {
271
272
anim . current . setValue ( 0 ) ;
272
273
}
0 commit comments