Skip to content

Commit 49e1993

Browse files
author
alvaromb
committed
closes #5 Hide placeholder when focused
1 parent 412ccab commit 49e1993

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

FloatingLabel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FloatingLabel extends Textbox {
5454
{locals.label}
5555
</Animated.Text>
5656

57-
const placeholderString = (self.state.placeholderString !== undefined) ? self.state.placeholderString : locals.label;
57+
const placeholderString = (self.state.fieldFocused) ? '' : self.state.placeholderString || locals.label;
5858
return (
5959
<TouchableWithoutFeedback onPress={() => {
6060
if (locals.editable === false) {
@@ -147,6 +147,10 @@ class FloatingLabel extends Textbox {
147147
].forEach((name) => locals[name] = this.props.options[name]);
148148
return locals;
149149
}
150+
151+
shouldComponentUpdate (nextProps, nextState) {
152+
return true;
153+
}
150154
}
151155

152156
const styles = React.StyleSheet.create({

0 commit comments

Comments
 (0)