React Native Android Essay Diary

Source: Internet
Author: User

1, used to do when the ListView will have a scroll bar, without any explanation, very ugly, before want to get rid of,

Stumbled upon today ScrollView has two properties

When this property is true, a horizontal scroll bar is displayed.

When this property is true, a vertical scroll bar is displayed.

Always remember to try. Sure, it worked, and the validation was successful.

2, some concise code syntax old will forget how to write, now found a record a

<view Style={[styles.innercontainer, {marginbottom:47}]}></view>
<text style={{color: ' Red '}}>{this.state.second>=0?this.state.second: ' re-issued verification code '}</text>
<text style={this.state.selectstate==0?styles.presstextnianfen:styles.textnianfen}> All </Text>
<image  Source={rowdata.currentscore>1?require ('.. /home/icon_star_yellow.png '): Require ('.. /home/icon_star_grey.png ')}              style={{width:15,height:15,marginright:2}}/>

  <view style={{width:150,height:150,backgroundcolor:this.state.selectcenterstate[rowid]==0? "#E9E6E6": "#D2EDF6", Borderradius:5,flexdirection: ' Column '}}>

3, about how to touch the update after the pop page problem

A good solution from a page push to page B, pass a refreshed function in the past, so from the B-page pop back to the a page, the function is called.

For example a page code: callback function to pass a refreshed function fetchstorise ()

Pusheditcenter (talkmsg) {let   _this = this;  This. Props.navigator.push ({    name: ' Editcenter ',    component:trainerselfcenteredit,    params : {      talkmsg:talkmsg,      getparams:function () {      _this.fetchstories ();      }}}  )}  

b page code, call the callback function when the pop

Pushback () {    const {Navigator} = this. props;    if (this. Props.getparams) {this.       props.getparams ();    }    If(navigator) {//out of stack, return to previous page Navigator.pop ();}}    

4, about how to use the timer

The reason for this is that the RN is developing too fast, the syntax is changing, and the use of the method is changed, and now it uses the newest ES6 syntax.

Componentdidmount () {   this.timer=setTimeout (        () ={          this.setstate ({content: ' This is what the timer prints.   })                     ;},2000);    this.timer_two=setTimeout (() ={this.setstate ({msg: ' This is the second paragraph of the timer print '})},4000 );} Componentwillunmount () {this.timer&&cleartimeout (this. timer); This.timer_two&&cleartimeout ( This. Timer_two); } render () {return (<view style={{margin:20}}> <Text>{this.state.content}</Text> <Text> {this.state.msg}</text> </View> ); }

Note: The timer function is relatively simple, note that when used in the ES6, it is important to remember to clear (Cleartimeout/clearinterval) all used timers when unmount components.

React Native Android Essay Diary

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: [email protected] 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.