-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add label
for the Input component
#990
Conversation
Codecov Report
@@ Coverage Diff @@
## next #990 +/- ##
=======================================
Coverage 54.36% 54.36%
=======================================
Files 34 34
Lines 607 607
Branches 112 112
=======================================
Hits 330 330
Misses 220 220
Partials 57 57
Continue to review full report at Codecov.
|
src/input/Input.js
Outdated
label != null && | ||
<Text style={[styles.label, labelStyle]}> | ||
{label} | ||
</Text> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be the same as label && element
not so? Any reason why explicitly checking for null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I was thinking about the case where label is an empty string, but I can't think about any use case for that
src/input/Input.js
Outdated
@@ -101,9 +111,9 @@ class Input extends Component { | |||
</View> | |||
)} | |||
</Animated.View> | |||
{displayError && ( | |||
{errorMessage != null && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
6736bf2
to
729a0a9
Compare
Example app for the last commit (729a0a9): |
Refs #892
Associated PR for the example app: react-native-elements/react-native-elements-app#48
Props changes
label
adds a label on top of the InputlabelStyle
adds style to the labeldisplayError
props. If theerrorMessage
is not null, I suppose there is an error to display…I basically took back the style of the old
FormLabel
Result