React-native make a text input box component

Source: Internet
Author: User

I'm back again!

As the company's projects have been doing recently, and more urgent. Now the project has been iterative to the third phase, can slow down ...

Today in the company to listen to the front-end said that the project was originally done with react-native (last October), but to do half of the discovery pit too much, halfway to give up, so let us Android and iOS re-development ...

As a very fond of this technology, I mean quite a lot of disobedience.

So I plan to use my spare time to do an identical out, anyway interface I have (hehe)

To tell the truth, has been using Android for development recently, and the time is not well-off, react-native a little rusty.

Okay, nonsense, don't say, today in the login interface, I found that the login registration text box style is a kind of, if one of the write, it will appear to be a bit troublesome, so I simply encapsulated a textinput this component

Is the effect I put on the login screen.

Code:

1Import React, {Component} from ' React ';2 3 Import {4 Text,5 TextInput,6 View,7 Proptypes,8 StyleSheet,9 toastandroidTen} from ' React-native ' One  A class Textinputlogin extends Component { -Static Proptypes = { - name:React.PropTypes.string, the txtHide:React.PropTypes.string, - Ispassword:React.PropTypes.bool -       } -  +Static Defaultprops = { -Name: ' Names ', +Txthide: ' Content ', AIspassword:false, at     } - Constructor (props) { - Super (props) -          This. State = { -Txtvalue: "", -         } in     } - render () { to         var{style, name, Txthide, Ispassword} = This. Props +         return( -<view style={styles.container,style}> the<view style={styles.txtborder}> *<text style={styles.txtname}>{name}</text> $<TextInputPanax NotoginsengUnderlinecolorandroid = {' Transparent '} -style={Styles.textinput} themultiline={false} +Placeholder={txthide} Apassword={Ispassword} theonchangetext={(text) = { +                              This. SetState ({ - Txtvalue:text $                             }) $                         }} -value={ This. State.txtvalue} -/> the</View> -</View>Wuyi         ) the     } - GetValue () { Wu         return  This. State.txtvalue -     } About } $  -Const STYLES =stylesheet.create ({ - container: { -Flex:1, AAlignitems: ' Center ', +Flexdirection: ' Row ' the     }, - Txtborder: { $Height:50, theFlex:1, theBorderwidth:1, theBorderColor: ' #51A7F9 ', theMarginleft:50, -Marginright:50, inBorderradius:25, theFlexdirection: ' Row ' the     }, About txtname: { theHeight:20, theWidth:40, theMarginleft:20, +Fontsize:15, -Margintop:15, theColor: ' #51A7F9 ',BayiMarginright:10, theFontsize:14 the     }, - textInput: { -Height:50, thewidth:200 the     } the }) the  -Module.exports = Textinputlogin;

React-native make a text input box component

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.