@@ -20,6 +20,7 @@ import {
2020const ActionButton = props => {
2121 const [ , setResetToken ] = useState ( props . resetToken ) ;
2222 const [ active , setActive ] = useState ( props . active ) ;
23+ const useNativeDriver = props . useNativeDriver || false ;
2324 const anim = useRef ( new Animated . Value ( props . active ? 1 : 0 ) ) ;
2425 const timeout = useRef ( null ) ;
2526 const mounted = useRef ( false ) ;
@@ -35,13 +36,13 @@ const ActionButton = props => {
3536
3637 useEffect ( ( ) => {
3738 if ( props . active ) {
38- Animated . spring ( anim . current , { toValue : 1 } ) . start ( ) ;
39+ Animated . spring ( anim . current , { toValue : 1 , useNativeDriver } ) . start ( ) ;
3940 setActive ( true ) ;
4041 setResetToken ( props . resetToken ) ;
4142 } else {
4243 props . onReset && props . onReset ( ) ;
4344
44- Animated . spring ( anim . current , { toValue : 0 } ) . start ( ) ;
45+ Animated . spring ( anim . current , { toValue : 0 , useNativeDriver } ) . start ( ) ;
4546 timeout . current = setTimeout ( ( ) => {
4647 setActive ( false ) ;
4748 setResetToken ( props . resetToken ) ;
@@ -254,7 +255,7 @@ const ActionButton = props => {
254255 if ( active ) return reset ( animate ) ;
255256
256257 if ( animate ) {
257- Animated . spring ( anim . current , { toValue : 1 } ) . start ( ) ;
258+ Animated . spring ( anim . current , { toValue : 1 , useNativeDriver } ) . start ( ) ;
258259 } else {
259260 anim . current . setValue ( 1 ) ;
260261 }
@@ -266,7 +267,7 @@ const ActionButton = props => {
266267 if ( props . onReset ) props . onReset ( ) ;
267268
268269 if ( animate ) {
269- Animated . spring ( anim . current , { toValue : 0 } ) . start ( ) ;
270+ Animated . spring ( anim . current , { toValue : 0 , useNativeDriver } ) . start ( ) ;
270271 } else {
271272 anim . current . setValue ( 0 ) ;
272273 }
0 commit comments