If you want a condition to show elements, you can use something like this.
renderButton() {
if (this.state.loading) {
return <Spinner size="small" spinnerStyle={styles.spinnerStyle} />;
}
return (
<Button onPress={this.onButtonPress.bind(this)}>
Log In
</Button>
);
}
Then call the helping method inside render function.
<View style={styles.buttonStyle}>
{this.renderButton()}
</View>
Or you can use another way of condition inside return.
{this.props.hasImage ? <element1> : <element2>}