javascript - React native: How to move Input from center to top with animation? -


i'm trying code input, moved center top when user start typing text. how can change justifycontent: 'center' justifycontent: 'flex-start' animation? or maybe there way?

my code:

<view style={styles.container}>   <searchinput     onchangetext={this.handleinputchange}   /> </view> 

and styles:

const styles = {   container: {     flex: 1,     alignitems: 'stretch',     justifycontent: 'center',     flexdirection: 'column'   } }; 

you should able achieve free using layoutanimation.

this do, things left out:

handlefocus = () => {   layoutanimation.easeineaseout();   this.setstate({     issearching: true,   }); };  render() {   const style = {     justifycontent: this.state.issearching       ? 'flex-start'       : 'center',   };   return (     <textinput onfocus={this.handlefocus} style={style} />   ); } 

if doesn't work, doubt, have use animated.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -