Skip to content

Commit 33d5675

Browse files
committed
Added the label styling
1 parent 1b6fed7 commit 33d5675

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

FloatingLabel.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Text, TextInput, View, Animated, PixelRatio } from 'react-native'
1+
import React, { Text, TextInput, View, Animated } from 'react-native'
22
import t from 'tcomb-form-native'
33

44
const Component = t.form.Component
@@ -19,14 +19,13 @@ class FloatingLabel extends Component {
1919
return function (locals) {
2020
const stylesheet = locals.stylesheet;
2121
let formGroupStyle = stylesheet.formGroup.normal;
22-
// TODO: var controlLabelStyle = stylesheet.controlLabel.normal;
22+
let controlLabelStyle = stylesheet.controlLabel.normal;
2323
let textboxStyle = stylesheet.textbox.normal;
2424
let helpBlockStyle = stylesheet.helpBlock.normal;
2525
let errorBlockStyle = stylesheet.errorBlock;
2626

2727
if (locals.hasError) {
28-
// TODO: control error
29-
// controlLabelStyle = stylesheet.controlLabel.error;
28+
controlLabelStyle = stylesheet.controlLabel.error;
3029
formGroupStyle = stylesheet.formGroup.error;
3130
textboxStyle = stylesheet.textbox.error;
3231
helpBlockStyle = stylesheet.helpBlock.error;
@@ -39,14 +38,14 @@ class FloatingLabel extends Component {
3938
const help = locals.help ? <Text style={helpBlockStyle}>{locals.help}</Text> : null;
4039
const error = locals.hasError && locals.error ? <Text style={errorBlockStyle}>{locals.error}</Text> : null;
4140
const label =
42-
<Animated.Text style={{
41+
<Animated.Text style={[controlLabelStyle, {
4342
opacity: self.state.fadeAnim,
4443
transform: [{
4544
translateY: self.state.fadeAnim.interpolate({
4645
inputRange: [0, 1],
4746
outputRange: [10, 0]
4847
}),
49-
}],}}>
48+
}]}]}>
5049
{locals.label}
5150
</Animated.Text>
5251

@@ -135,11 +134,6 @@ class FloatingLabel extends Component {
135134
}
136135

137136
const styles = React.StyleSheet.create({
138-
container: {
139-
paddingTop: 20,
140-
borderBottomColor: 'gray',
141-
borderBottomWidth: 1 / PixelRatio.get(),
142-
},
143137
textInput: {
144138
height: 40,
145139
}

0 commit comments

Comments
 (0)