Reputation: 1555
I am trying to show error message conditionally on react native element input component but seems like it doesn't work
<Input
label="Email"
leftIcon={<MaterialIcon name="email" size={24} color="#f8dc81" />}
onChangeText={(value) => setEmail(value)}
value={email}
renderErrorMessage={false}
errorMessage="Enter valid email"
/>
Expected behavior that it will not display error message but it displays
Upvotes: 0
Views: 1289
Reputation: 749
As doc renderErrorMessage is to handle the space taken by the errorMessage.
If the error message container should be rendered (take up vertical space). If false, when showing errorMessage, the layout will shift to add it at that time.
So if errorMessage is present it will show error, even if renderErrorMessage
is false
Upvotes: 1