11

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'                                                    
/>
Sathish Sundharam
  • 1,060
  • 2
  • 12
  • 22

2 Answers2

28

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

Irfan Ayaz
  • 797
  • 8
  • 16
6

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}
.....                                                    
/>
Rezaul Karim
  • 830
  • 8
  • 15