user1017674 user1017674 - 29 days ago 4
React JSX Question

Native base dynamically show success or Error input

I want to have two simple input boxes.

There is a loginName input box, and a password input box.

Currently I map the value of these two input box into a "state".

Now, using NativeBase. How do I dynamically show "success" "error" like how they did in the demo?
http://nativebase.io/docs/v0.5.9/components#successInputTextbox

Answer

Passing a prop success is equivalent to passing success={true}

So if you have state variables like inputSuccess and inputError, you can do this:

<InputGroup 
  iconRight 
  success={this.state.inputSuccess ? true : false} 
  error={this.state.inputError ? true : false}>
  <Icon name='ios-checkmark-circle' style={{color:'#00C497'}}/>
  <Input placeholder='Textbox'/>
</InputGroup>
Comments