-
Notifications
You must be signed in to change notification settings - Fork 734
Support rendering leading Icon to TextField #815
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
Conversation
@@ -57,6 +64,8 @@ export default class BasicTextFieldScreen extends Component { | |||
error | |||
} = this.state; | |||
|
|||
|
|||
|
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.
typo?
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.
I think it's a github issue..
anyway I remove those lines, maybe it'll fix it..
src/components/inputs/TextField.js
Outdated
@@ -642,6 +649,7 @@ export default class TextField extends BaseInput { | |||
{paddingTop: this.getTopPaddings()} | |||
]} | |||
> | |||
{leadingIcon && <Image {...leadingIcon} onLayout={this.onLeadingIconLayout}/>} |
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.
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.
fixed
const LEADING_ICON = { | ||
source: Assets.icons.demo.search, | ||
style: {marginRight: Spacings.s1} | ||
}; |
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.
We don't want to supply a default margin and let it be overridden?
This forces to always supply a margin since it doesn't look good without it.
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.
I preferred to keep it clean as long as it doesn't look bad without custom styling.
This spacing is just for the sake of this example.
I assume we will pass something else in the private config
return Boolean(floatingPlaceholder && !centered && !this.shouldShowTopError()); | ||
const {floatingPlaceholder, centered, leadingIcon, prefix} = this.getThemeProps(); | ||
|
||
return !leadingIcon && !prefix && Boolean(floatingPlaceholder && !centered && !this.shouldShowTopError()); |
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.
Why not to allow leading icon and floatingPlaceholder?. Missing onLayout implementation for this of course (See relevant comment above).
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.
I was about to add it, but it caused a weird UI issue where the floating placeholder transition looked bad.
Anyway, I discussed with Yulia and she agreed there's no reason for both of these features to come together.
src/components/inputs/TextField.js
Outdated
@@ -216,7 +220,7 @@ export default class TextField extends BaseInput { | |||
const translate = width / 2 - (width * FLOATING_PLACEHOLDER_SCALE) / 2; | |||
this.setState({floatingPlaceholderTranslate: translate / FLOATING_PLACEHOLDER_SCALE}); | |||
}; | |||
|
|||
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.
tab
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.
fixed
leadingIcon
propprefix
orleadingIcon
withfloatingPlaceholder
(WOAUILIB-499)