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
Post a Comment