Setting a border for react native TextInput -


using react native 0.26,

my component this

const search = () => {     return (       <view style={styles.backgroundimage}>         <textinput style={styles.textinput} onchangetext={(text) => console.log(text)} placeholder={"enter search term"}/>       </view>     ) } 

and styles :

const styles = stylesheet.create({   backgroundimage: {     flex : 1,     flexdirection: "column",     justifycontent: 'center',     alignitems: 'center'   },   textinput: {     justifycontent: "center",     alignitems: "stretch",     borderrightwidth: 30,     borderleftwidth: 30,     height: 50,     bordercolor: "#ffffff",   } }) 

the problems facing are

  1. the border right width , left width not seem have effect , placeholder text begins on left edge.
  2. the background of textinput "grey" same view's background. expecting white default, (feels transparent).
  3. with ios simulator how bring keyboard, set returnkeytype , see how keyboard looks (and have code on onsubmitediting , test).

screenshot below : screenshot

1 cannot declare specific border directly on textinput unless multiline enabled (for example borderleftwidth not work unless multiline={true} enabled borderwidth work), can wrap textinput in view , give border.

inputcontainer: {   borderleftwidth: 4,   borderrightwidth: 4,   height: 70 }, input: {   height: 70,   backgroundcolor: '#ffffff',   paddingleft: 15,   paddingright: 15 } 

2 need declare backgroundcolor textinput.

3 make native keyboard show up, need go simulator menu , disconnect hardware. go hardware -> keyboard -> connect hardware keyboard, toggle off.

[![enter image description here][2]][2]


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -