Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native TextInput border not working

Here's my style for the input:

 searchBarInput: {
  flex: 1,
  fontSize: 20,
  fontWeight: 'bold',
  color: 'white',
  height: 50,
  padding: 0,
  backgroundColor: 'transparent',
  borderColor: '#000000', 
  borderWidth: 50,  
  borderStyle: 'solid',
 }

If I change the border width, the size of the input changes, but still there's no visible border.

I am using react-native 0.15.0 with an android device.

like image 948
xtrinch Avatar asked Nov 29 '15 14:11

xtrinch


People also ask

How do you give border radius to TextInput in React Native?

Step-1 : Create a new React Native project. Step-2 : Add Platform, StyleSheet, Text, View, TextInput Component in import block. property of CSS Stylesheet in TextInput Component. This CSS property will change the TextInput field border to rounded corner.

How do I change the border color of TextInput in React Native?

TextInput has by default a border at the bottom of its view. This border has its padding set by the background image provided by the system, and it cannot be changed.

How do I remove the TextInput border in React Native?

Just set the underlineColorAndroid prop of TextInput to transparent or the color which is the background color of the input field.


3 Answers

Does this answer your question : https://github.com/facebook/react-native/blob/master/docs/KnownIssues.md#text-input-border

It seems it is a known bug from react-native...

You can try and wrap it in a view component and set the border you want on the view component.

like image 77
G. Hamaide Avatar answered Nov 03 '22 07:11

G. Hamaide


As per react native doc, you need to set below in text input properties:

multiline={true}
like image 43
jainmitesh09 Avatar answered Nov 03 '22 07:11

jainmitesh09


This is now fixed on Android via underlineColorAndroid="transparent"

source: https://facebook.github.io/react-native/releases/0.26/docs/known-issues.html#text-input-border (archive)

like image 41
damio Avatar answered Nov 03 '22 09:11

damio