Skip to content

Commit 2572989

Browse files
authored
Merge pull request #19 from KrazyLabs/master
Update render function. Use this.state.text rather than this.prop.value
2 parents b1b20cc + ee1d5d5 commit 2572989

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
node_modules
2+
.idea

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var FloatingLabel = React.createClass({
2828
getInitialState () {
2929
var state = {
3030
text: this.props.value,
31-
dirty: !!this.props.value
31+
dirty: (this.props.value || this.props.placeholder)
3232
};
3333

3434
var style = state.dirty ? dirtyStyle : cleanStyle
@@ -123,20 +123,22 @@ var FloatingLabel = React.createClass({
123123
enablesReturnKeyAutomatically: this.props.enablesReturnKeyAutomatically,
124124
keyboardType: this.props.keyboardType,
125125
multiline: this.props.multiline,
126+
numberOfLines: this.props.numberOfLines,
126127
onBlur: this._onBlur,
127128
onChange: this.props.onChange,
128129
onChangeText: this.onChangeText,
129130
onEndEditing: this.updateText,
130131
onFocus: this._onFocus,
131132
onSubmitEditing: this.props.onSubmitEditing,
132133
password: this.props.secureTextEntry || this.props.password, // Compatibility
134+
placeholder: this.props.placeholder,
133135
secureTextEntry: this.props.secureTextEntry || this.props.password, // Compatibility
134136
returnKeyType: this.props.returnKeyType,
135137
selectTextOnFocus: this.props.selectTextOnFocus,
136138
selectionState: this.props.selectionState,
137139
style: [styles.input],
138140
testID: this.props.testID,
139-
value: this.props.value,
141+
value: this.state.text,
140142
underlineColorAndroid: this.props.underlineColorAndroid, // android TextInput will show the default bottom border
141143
onKeyPress: this.props.onKeyPress
142144
},

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "react-native-floating-labels",
3-
"version": "1.1.4",
2+
"name": "@krazylabs/react-native-floating-labels",
3+
"version": "1.1.5",
44
"description": "Reusabe floating lable component for react native",
55
"main": "index.js",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/mayank-patel/react-native-floating-labels.git"
8+
"url": "https://github.com/KrazyLabs/react-native-floating-labels"
99
},
1010
"keywords": [
1111
"react-component",
@@ -18,7 +18,7 @@
1818
"lodash": "^3.8.0"
1919
},
2020
"scripts": {
21-
"test": "echo 'Success'"
21+
"test": "echo 'Success'"
2222
},
2323
"author": "Mayank Patel",
2424
"license": "MIT"

0 commit comments

Comments
 (0)