reactjs - State updating, but not applying everywhere -
i'm trying make loading indicator replace image when button pushed, it's not working right. here's view looks like:
<view style={styles.header}> <progressbarandroid style={this.state.showprogress ? styles.image : styles.hidden } /> <image style={this.state.showprogress ? styles.hidden : styles.image } source={{uri: '....'}} /> </view> this.state.showprogress set false in constructor, , nothing show @ first, when push button runs this.setstate({showprogress: true}), loading indicator shows up.
is there i'm missing? if copy ternary operator progressbarandroid control, i'll image showing @ same time it, why not reverse?
is there better way accomplish this?
you like
<view style={styles.header}> { this.state.showprogress ? <progressbarandroid style={styles.image} /> : <image style={styles.image} source={{uri: '....'}} /> } </view> that way have single ternary , it's little easier at. if still doesn't work, there may wrong styles/elements specifically. post take look.
Comments
Post a Comment