React native android animation -


i'm trying animate height of view in react native. animation working expected in ios not working in android. animated view seems full height regardless of animation value. relevant code below:

var facets = react.createclass({   getinitialstate: function() {     return {       h: new animated.value(0),     };   },    _animate: function(newheight) {     animated.timing(this.state.h, {       duration: 300,       tovalue: newheight     }).start();   },    render: function() {     var facetcomponents = [];      if (this.props.shown) {       this._animate(max_height);     }     else {       this._animate(0);     }      facets.map( (facet, idx) => {       facetcomponents.push(         <facet           key={idx}           facet={facet}           filterby={this.props.filterby} />);     });      return (       <animated.view style={{ maxheight: this.state.h }}>         {facetcomponents}       </animated.view>     );   } }); 

try moving animated value out of state:

componentdidmount() {   this.h = new animated.value(0) } 

then, refer this.h opposed this.state.h


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -