Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextInput underline color for ios in react-native

i am doing mobile applications in react-native for android and ios. In my project i am using TextInput Component(ios). This component appear without underline. How to use TextInput with underline color in ios.

code sample -

<TextInput
 ref={'cardbatch1'}                 
 keyboardType = 'numeric'
 placeholder = 'Batch Number'
 autoCapitalize = 'none'                                                    
/>
like image 250
Sathish Sundharam Avatar asked Jul 13 '17 11:07

Sathish Sundharam


2 Answers

Try this in styles.. see the difference in output

const styles = StyleSheet.create({

    inputBox: {
        .....
        borderBottomWidth: 1,
        borderBottomColor: 'gray',
        ....
    }
});

Finally add the style in textInput

<TextInput
 ...             
 keyboardType = 'numeric'
 placeholder = 'Batch Number'
 autoCapitalize = 'none'
 style={styles.inputBox}
.....                                                    
/>
like image 88
Rezaul Karim Avatar answered Sep 28 '22 05:09

Rezaul Karim


You could add borderBottomWidth and borderBottomColor to TextInput or simply draw a view with 1 or 2 px height below TextInput.

like image 24
Irfan Ayaz Avatar answered Sep 28 '22 04:09

Irfan Ayaz