11'use strict' ;
22
33var React = require ( 'react-native' ) ;
4- var tweenState = require ( 'react-tween-state' ) ; // Animate header
4+ var Animated = require ( 'Animated' ) ;
5+ var Easing = require ( 'Easing' ) ;
56
67var NavButton = require ( './NavButton' ) ;
78
@@ -14,26 +15,26 @@ var {
1415
1516var NavBarContent = React . createClass ( {
1617
17- mixins : [ tweenState . Mixin ] ,
18-
1918 getInitialState : function ( ) {
2019 return {
21- opacity : this . props . willDisappear ? 1 : 0
20+ opacity : this . props . willDisappear ? new Animated . Value ( 1 ) : new Animated . Value ( 0 )
2221 } ;
2322 } ,
2423
2524 componentWillReceiveProps : function ( newProps ) {
2625 if ( newProps . route !== this . props . route ) {
27- this . setState ( {
28- opacity : this . props . willDisappear ? 1 : 0
29- } ) ;
26+ this . state . opacity . setValue ( this . props . willDisappear ? 1 : 0 ) ;
3027
3128 setTimeout ( ( ) => {
32- this . tweenState ( 'opacity' , {
33- easing : tweenState . easingTypes . easeInOutQuad ,
34- duration : 200 ,
35- endValue : 1
36- } ) ;
29+ Animated . timing (
30+ this . state . opacity ,
31+ {
32+ fromValue : this . props . willDisappear ? 1 : 0 ,
33+ toValue : this . props . willDisappear ? 0 : 1 ,
34+ duration : 300 ,
35+ easing : Easing . easeOutQuad
36+ }
37+ ) . start ( ) ;
3738 } , 0 ) ;
3839 }
3940 } ,
@@ -54,7 +55,7 @@ var NavBarContent = React.createClass({
5455
5556 render ( ) {
5657 var transitionStyle = {
57- opacity : this . getTweeningValue ( ' opacity' ) ,
58+ opacity : this . state . opacity ,
5859 } ;
5960
6061 var leftCorner ;
@@ -128,11 +129,11 @@ var NavBarContent = React.createClass({
128129 var color = this . props . borderColor ? this . props . borderColor : null ;
129130
130131 return (
131- < View style = { [ styles . navbar , transitionStyle , this . props . route . headerStyle , { borderBottomWidth : width , borderColor : color } , trans ] } >
132+ < Animated . View style = { [ styles . navbar , transitionStyle , this . props . route . headerStyle , { borderBottomWidth : width , borderColor : color } , trans ] } >
132133 { leftCorner }
133134 { titleComponent }
134135 { rightCorner }
135- </ View >
136+ </ Animated . View >
136137 ) ;
137138 }
138139} ) ;
0 commit comments