Skip to content
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

[TextField] fix the floating label and hint text position #1035

Merged
merged 1 commit into from
Jul 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/src/app/components/pages/components/text-fields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ let TextFieldsPage = React.createClass({
style={styles.textfield}
hintText="Hint Text (MultiLine)"
multiLine={true} /><br/>
<TextField
style={styles.textfield}
hintText="The hint text can be as long as you want, it will wrap."
multiLine={true} /><br/>
<TextField
style={styles.textfield}
hintText="Hint Text"
errorText="The error text can be as long as you want, it will wrap." /><br/>
<TextField
style={styles.textfield}
hintText="Hint Text"
Expand Down
8 changes: 4 additions & 4 deletions src/text-field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ let TextField = React.createClass({
},
hint: {
position: 'absolute',
lineHeight: '20px',
lineHeight: '22px',
opacity: 1,
color: theme.hintColor,
transition: Transitions.easeOut(),
bottom: '10px'
bottom: 12
},
input: {
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
Expand Down Expand Up @@ -148,8 +148,9 @@ let TextField = React.createClass({
};

styles.floatingLabel = this.mergeStyles(styles.hint, {
lineHeight: '20px',
lineHeight: '22px',
top: 38,
bottom: 'none',
opacity: 1,
transform: 'scale(1) translate3d(0, 0, 0)',
transformOrigin: 'left top'
Expand Down Expand Up @@ -182,7 +183,6 @@ let TextField = React.createClass({
}

if (props.floatingLabelText) {
styles.hint.top = 24;
styles.hint.opacity = 0;
styles.input.boxSizing = 'border-box';
if (this.state.isFocused && !this.state.hasValue) styles.hint.opacity = 1;
Expand Down